From 9cbacedf347e841c0dfbd30fef3a20a3a425bda4 Mon Sep 17 00:00:00 2001 From: RMBGAME Date: Sat, 23 Jul 2022 18:45:46 +0800 Subject: [PATCH] fix LiveCharts Theme --- .../Application/UI/App.axaml.cs | 40 +++++++++---------- .../Views/Controls/UserControl/AdDialog.axaml | 4 +- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/App.axaml.cs b/src/ST.Client.Desktop.Avalonia/Application/UI/App.axaml.cs index 86a3275c9..71d459c49 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/App.axaml.cs +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/App.axaml.cs @@ -144,6 +144,26 @@ namespace System.Application.UI // //}; // Resources.MergedDictionaries[0] = (ResourceDictionary)AvaloniaXamlLoader.Load(uri_1); //} + + LiveCharts.Configure(config => + { + config + // registers SkiaSharp as the library backend + // REQUIRED unless you build your own + .AddSkiaSharp(); + // adds the default supported types + // OPTIONAL but highly recommend + //.AddDefaultMappers() + + // select a theme, default is Light + // OPTIONAL + //.AddDarkTheme() + + if (value == AppTheme.Light) + config.AddLightTheme(); + else + config.AddDarkTheme(); + }); } public static void SetThemeAccent(string? colorHex) @@ -231,26 +251,6 @@ namespace System.Application.UI } MainWindow.DataContext = vmService.MainWindow; }, isTrace: isTrace); - - LiveCharts.Configure(config => - { - config - // registers SkiaSharp as the library backend - // REQUIRED unless you build your own - .AddSkiaSharp(); - // adds the default supported types - // OPTIONAL but highly recommend - //.AddDefaultMappers() - - // select a theme, default is Light - // OPTIONAL - //.AddDarkTheme() - - if (Theme == AppTheme.Light) - config.AddLightTheme(); - else - config.AddDarkTheme(); - }); #if WINDOWS InitWebView2(); #endif diff --git a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/UserControl/AdDialog.axaml b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/UserControl/AdDialog.axaml index cc106ad29..ac70499ac 100644 --- a/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/UserControl/AdDialog.axaml +++ b/src/ST.Client.Desktop.Avalonia/Application/UI/Views/Controls/UserControl/AdDialog.axaml @@ -33,11 +33,11 @@