Update Avalonia to 11.0
This commit is contained in:
parent
dc2eefc43d
commit
1246a011c9
@ -1,18 +1,8 @@
|
||||
<Application xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="AvaloniaCoreRTDemo.App">
|
||||
<NativeMenu.Menu>
|
||||
<NativeMenu>
|
||||
<NativeMenuItem Header="About" Gesture="cmd+b" IsEnabled="{Binding AboutEnabled}" Command="{Binding HelpAboutMethod}"/>
|
||||
</NativeMenu>
|
||||
</NativeMenu.Menu>
|
||||
<Application.Styles>
|
||||
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseDark.xaml"/>
|
||||
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
|
||||
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
|
||||
</Application.Styles>
|
||||
<Application.Resources>
|
||||
<FluentTheme x:Key="fluentLight" Mode="Light" />
|
||||
<FluentTheme x:Key="fluentDark" Mode="Dark" />
|
||||
<FluentTheme x:Key="fluentTheme" Mode="Light" />
|
||||
<SimpleTheme x:Key="simpleTheme" Mode="Light" />
|
||||
</Application.Resources>
|
||||
</Application>
|
@ -4,7 +4,7 @@ using Avalonia.Controls.ApplicationLifetimes;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Avalonia.Styling;
|
||||
using Avalonia.Themes.Fluent;
|
||||
|
||||
using Avalonia.Themes.Simple;
|
||||
using AvaloniaCoreRTDemo.Interfaces;
|
||||
using AvaloniaCoreRTDemo.Windows;
|
||||
|
||||
@ -12,11 +12,8 @@ namespace AvaloniaCoreRTDemo
|
||||
{
|
||||
public sealed class App : Application, IThemeSwitch
|
||||
{
|
||||
private IStyle _baseLight;
|
||||
private IStyle _baseDark;
|
||||
|
||||
private IStyle _fluentLight;
|
||||
private IStyle _fluentDark;
|
||||
private FluentTheme _fluentTheme;
|
||||
private SimpleTheme _simpleTheme;
|
||||
|
||||
private ApplicationTheme _currentTheme;
|
||||
|
||||
@ -31,7 +28,7 @@ namespace AvaloniaCoreRTDemo
|
||||
this.InitializeThemes();
|
||||
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
||||
{
|
||||
desktop.MainWindow = !Utilities.IsOSX ? new MainWindow() : new MainWindowMacOS();
|
||||
desktop.MainWindow = new MainWindow();
|
||||
this.DataContext = desktop.MainWindow.DataContext;
|
||||
}
|
||||
base.OnFrameworkInitializationCompleted();
|
||||
@ -39,15 +36,11 @@ namespace AvaloniaCoreRTDemo
|
||||
|
||||
private void InitializeThemes()
|
||||
{
|
||||
this._baseDark = this.Styles[0];
|
||||
this._baseLight = this.Styles[1];
|
||||
this._fluentTheme = (FluentTheme)this.Resources["fluentTheme"]!;
|
||||
this._simpleTheme = (SimpleTheme)this.Resources["simpleTheme"]!;
|
||||
Styles.Add(_fluentTheme);
|
||||
|
||||
this.Styles.Remove(this._baseDark);
|
||||
|
||||
this._fluentLight = (FluentTheme)this.Resources["fluentLight"]!;
|
||||
this._fluentDark = (FluentTheme)this.Resources["fluentDark"]!;
|
||||
|
||||
this._currentTheme = ApplicationTheme.DefaultLight;
|
||||
this._currentTheme = ApplicationTheme.FluentLight;
|
||||
}
|
||||
|
||||
ApplicationTheme IThemeSwitch.Current => this._currentTheme;
|
||||
@ -57,25 +50,21 @@ namespace AvaloniaCoreRTDemo
|
||||
this._currentTheme = theme;
|
||||
switch (theme)
|
||||
{
|
||||
case ApplicationTheme.DefaultLight:
|
||||
this.Styles[0] = this._baseLight;
|
||||
this.Styles.Remove(this._baseDark);
|
||||
case ApplicationTheme.SimpleLight:
|
||||
this._simpleTheme.Mode = SimpleThemeMode.Light;
|
||||
this.Styles[0] = this._simpleTheme;
|
||||
break;
|
||||
case ApplicationTheme.DefaultDark:
|
||||
this.Styles[0] = this._baseDark;
|
||||
this.Styles.Remove(this._baseLight);
|
||||
case ApplicationTheme.SimpleDark:
|
||||
this._simpleTheme.Mode = SimpleThemeMode.Dark;
|
||||
this.Styles[0] = this._simpleTheme;
|
||||
break;
|
||||
case ApplicationTheme.FluentLight:
|
||||
this.Styles[0] = this._fluentLight;
|
||||
this.Styles.Remove(this._fluentDark);
|
||||
if (!this.Styles.Contains(this._baseLight))
|
||||
this.Styles.Add(this._baseLight);
|
||||
this._fluentTheme.Mode = FluentThemeMode.Light;
|
||||
this.Styles[0] = this._fluentTheme;
|
||||
break;
|
||||
case ApplicationTheme.FluentDark:
|
||||
this.Styles[0] = this._fluentDark;
|
||||
this.Styles.Remove(this._baseLight);
|
||||
if (!this.Styles.Contains(this._baseDark))
|
||||
this.Styles.Add(this._baseDark);
|
||||
this._fluentTheme.Mode = FluentThemeMode.Dark;
|
||||
this.Styles[0] = this._fluentTheme;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -4,8 +4,8 @@ namespace AvaloniaCoreRTDemo
|
||||
{
|
||||
public enum ApplicationTheme : Byte
|
||||
{
|
||||
DefaultLight = 0,
|
||||
DefaultDark = 1,
|
||||
SimpleLight = 0,
|
||||
SimpleDark = 1,
|
||||
FluentLight = 2,
|
||||
FluentDark = 3,
|
||||
}
|
||||
|
@ -9,10 +9,10 @@
|
||||
<InvariantGlobalization>true</InvariantGlobalization>
|
||||
<!--https://docs.microsoft.com/en-us/dotnet/core/deploying/trimming/trimming-options-->
|
||||
<TrimmerDefaultAction>link</TrimmerDefaultAction>
|
||||
|
||||
<IsWindows Condition="$([MSBuild]::IsOSPlatform('Windows'))">true</IsWindows>
|
||||
<IsLinux Condition="$([MSBuild]::IsOSPlatform('Linux'))">true</IsLinux>
|
||||
<IsOSX Condition="$([MSBuild]::IsOSPlatform('OSX'))">true</IsOSX>
|
||||
<DefineConstants Condition="'$(IsOSX)'=='true'">OSX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
@ -30,31 +30,34 @@
|
||||
|
||||
<ItemGroup>
|
||||
<AvaloniaResource Include="Assets/**" />
|
||||
<EmbeddedResource Include="Images/**" />
|
||||
<None Update="avalonia.png" CopyToPublishDirectory="PreserveNewest">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="dotnet.png" CopyToPublishDirectory="PreserveNewest">
|
||||
<AvaloniaResource Include="Images/**" />
|
||||
<None Update="Assets/app.icns" CopyToPublishDirectory="PreserveNewest" Condition="$(RuntimeIdentifier.StartsWith('osx'))">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="Assets/app.icns" CopyToPublishDirectory="PreserveNewest" Condition="$(RuntimeIdentifier.StartsWith('osx'))">
|
||||
<None Update="dotnet.png">
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Update="avalonia.png">
|
||||
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Avalonia" Version="0.10.16" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="0.10.16" />
|
||||
<PackageReference Include="Avalonia.Native" Version="0.10.16" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.10.16" />
|
||||
<PackageReference Include="Avalonia" Version="11.0.0-preview4" />
|
||||
<PackageReference Include="Avalonia.Desktop" Version="11.0.0-preview4" />
|
||||
<PackageReference Include="Avalonia.ReactiveUI" Version="11.0.0-preview4" />
|
||||
<PackageReference Include="Avalonia.Themes.Simple" Version="11.0.0-preview4" />
|
||||
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.0.0-preview4" />
|
||||
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.16" />
|
||||
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.0.0-preview4" />
|
||||
<!--Condition below is needed to generate macOS App only.-->
|
||||
<PackageReference Include="Dotnet.Bundle" Version="*" Condition="$(RuntimeIdentifier.StartsWith('osx'))" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Information for Dotnet.Bundle to Generate macOS app-->
|
||||
<PropertyGroup Condition="'$(IsOSX)'=='true'">
|
||||
<PropertyGroup>
|
||||
<CFBundleName>$(AssemblyName)</CFBundleName>
|
||||
<CFBundleDisplayName>$(AssemblyName)</CFBundleDisplayName>
|
||||
<CFBundleIdentifier>com.$(username).$(AssemblyName)</CFBundleIdentifier>
|
||||
@ -76,33 +79,5 @@
|
||||
<RdXmlFile Include="rd.xml" />
|
||||
<RuntimeHostConfigurationOption Include="Switch.System.Reflection.Assembly.SimulatedCallingAssembly" Value="true" />
|
||||
</ItemGroup>
|
||||
|
||||
<!--App axaml-->
|
||||
<ItemGroup>
|
||||
<Compile Update="App.axaml.cs">
|
||||
<DependentUpon>App.axaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<!--Cross platform xaml-->
|
||||
<ItemGroup>
|
||||
<Compile Update="Controls/MainControl.axaml.cs">
|
||||
<DependentUpon>MainControl.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Update="Windows/AboutWindow.axaml.cs">
|
||||
<DependentUpon>AboutWindow.axaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<!--No-OSX only xaml-->
|
||||
<ItemGroup Condition="'$(IsOSX)'!='true'">
|
||||
<Compile Update="Windows/MainWindow.axaml.cs">
|
||||
<DependentUpon>MainWindow.axaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<!--OSX only xaml-->
|
||||
<ItemGroup Condition="'$(IsOSX)'=='true'">
|
||||
<Compile Update="Windows/MainWindowMacOS.axaml.cs">
|
||||
<DependentUpon>MainWindowMacOS.axaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@ -18,13 +18,10 @@ namespace AvaloniaCoreRTDemo.Controls.ViewModels
|
||||
|
||||
public MainViewModel()
|
||||
{
|
||||
this._dotNetImage = Utilities.GetImageFromFile(GetImageFullPath("dotnet.png"));
|
||||
this._avaloniaImage = Utilities.GetImageFromFile(GetImageFullPath("avalonia.png"));
|
||||
this._dotNetImage = Utilities.GetImageFromFile("dotnet.png");
|
||||
this._avaloniaImage = Utilities.GetImageFromFile("avalonia.png");
|
||||
}
|
||||
|
||||
private static String GetImageFullPath(String fileName)
|
||||
=> Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName);
|
||||
|
||||
~MainViewModel()
|
||||
{
|
||||
this._dotNetImage.Dispose();
|
||||
|
@ -12,10 +12,6 @@ namespace AvaloniaCoreRTDemo
|
||||
// Avalonia configuration, don't remove; also used by visual designer.
|
||||
public static AppBuilder BuildAvaloniaApp()
|
||||
=> AppBuilder.Configure<App>().UsePlatformDetect()
|
||||
.UseAvaloniaNativeOSX()
|
||||
.LogToTrace();
|
||||
|
||||
private static AppBuilder UseAvaloniaNativeOSX(this AppBuilder appBuilder)
|
||||
=> Utilities.IsOSX ? appBuilder.UseAvaloniaNative() : appBuilder;
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
using Avalonia;
|
||||
using Avalonia.Media.Imaging;
|
||||
using Avalonia.Platform;
|
||||
|
||||
namespace AvaloniaCoreRTDemo
|
||||
{
|
||||
@ -15,25 +14,24 @@ namespace AvaloniaCoreRTDemo
|
||||
|
||||
public static Bitmap GetImageFromResources(String fileName)
|
||||
{
|
||||
Assembly asm = Assembly.GetExecutingAssembly();
|
||||
String resourceName = asm.GetManifestResourceNames().FirstOrDefault(str => str.EndsWith(fileName));
|
||||
if (resourceName != null)
|
||||
using (Stream bitmapStream = asm.GetManifestResourceStream(resourceName))
|
||||
return new Bitmap(bitmapStream);
|
||||
else
|
||||
return default;
|
||||
var assetLoader = AvaloniaLocator.Current.GetRequiredService<IAssetLoader>();
|
||||
using var assetStream = assetLoader.Open(new Uri($"avares://AvaloniaCoreRTDemo/Images/{fileName}"));
|
||||
return new Bitmap(assetStream);
|
||||
}
|
||||
|
||||
public static Bitmap GetImageFromFile(String path)
|
||||
{
|
||||
try
|
||||
{
|
||||
return new Bitmap(path);
|
||||
return new Bitmap(GetImageFullPath(path));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return GetImageFromResources("broken-link.png");
|
||||
}
|
||||
}
|
||||
|
||||
private static String GetImageFullPath(String fileName)
|
||||
=> Path.Combine(AppDomain.CurrentDomain.BaseDirectory, fileName);
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,29 @@
|
||||
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="clr-namespace:AvaloniaCoreRTDemo.Controls" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="AvaloniaCoreRTDemo.Windows.MainWindow"
|
||||
Width="640" Height="480" WindowStartupLocation="CenterScreen" Title="AvaloniaCoreRTDemo" Icon="avares://AvaloniaCoreRTDemo/Assets/app.ico" MinWidth="400" MinHeight="350">
|
||||
<DockPanel>
|
||||
<Menu DockPanel.Dock="Top">
|
||||
<MenuItem Header="_File">
|
||||
<MenuItem Header="_Exit" Command="{Binding FileExitCommand}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Theme">
|
||||
<MenuItem Header="Default Light" IsEnabled="{Binding DefaultLightEnabled}" Command="{Binding DefaultLightMethod}"/>
|
||||
<MenuItem Header="Default Dark" IsEnabled="{Binding DefaultDarkEnabled}" Command="{Binding DefaultDarkMethod}"/>
|
||||
<MenuItem Header="Fluent Light" IsEnabled="{Binding FluentLightEnabled}" Command="{Binding FluentLightMethod}"/>
|
||||
<MenuItem Header="Fluent Dark" IsEnabled="{Binding FluentDarkEnabled}" Command="{Binding FluentDarkMethod}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Help">
|
||||
<MenuItem Header="_About" IsEnabled="{Binding AboutEnabled}" Command="{Binding HelpAboutMethod}"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<controls:MainControl/>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="clr-namespace:AvaloniaCoreRTDemo.Controls" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="AvaloniaCoreRTDemo.Windows.MainWindow"
|
||||
Width="640" Height="480" WindowStartupLocation="CenterScreen" Title="AvaloniaCoreRTDemo" Icon="avares://AvaloniaCoreRTDemo/Assets/app.ico" MinWidth="400" MinHeight="350">
|
||||
<DockPanel>
|
||||
<NativeMenuBar DockPanel.Dock="Top" />
|
||||
<controls:MainControl/>
|
||||
</DockPanel>
|
||||
<NativeMenu.Menu>
|
||||
<NativeMenu>
|
||||
<NativeMenuItem Header="File">
|
||||
<NativeMenuItem.Menu>
|
||||
<NativeMenu>
|
||||
<NativeMenuItem Header="Exit" Gesture="cmd+e" Command="{Binding FileExitCommand}"/>
|
||||
</NativeMenu>
|
||||
</NativeMenuItem.Menu>
|
||||
</NativeMenuItem>
|
||||
<NativeMenuItem Header="Theme">
|
||||
<NativeMenuItem.Menu>
|
||||
<NativeMenu>
|
||||
<NativeMenuItem Header="Default Light" IsEnabled="{Binding DefaultLightEnabled}" Command="{Binding DefaultLightMethod}"/>
|
||||
<NativeMenuItem Header="Default Dark" IsEnabled="{Binding DefaultDarkEnabled}" Command="{Binding DefaultDarkMethod}"/>
|
||||
<NativeMenuItem Header="Fluent Light" IsEnabled="{Binding FluentLightEnabled}" Command="{Binding FluentLightMethod}"/>
|
||||
<NativeMenuItem Header="Fluent Dark" IsEnabled="{Binding FluentDarkEnabled}" Command="{Binding FluentDarkMethod}"/>
|
||||
</NativeMenu>
|
||||
</NativeMenuItem.Menu>
|
||||
</NativeMenuItem>
|
||||
</NativeMenu>
|
||||
</NativeMenu.Menu>
|
||||
</Window>
|
@ -1,26 +0,0 @@
|
||||
<Window xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:controls="clr-namespace:AvaloniaCoreRTDemo.Controls" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="AvaloniaCoreRTDemo.Windows.MainWindowMacOS"
|
||||
Width="640" Height="480" WindowStartupLocation="CenterScreen" Title="AvaloniaCoreRTDemo" Icon="avares://AvaloniaCoreRTDemo/Assets/app.ico" MinWidth="400" MinHeight="350">
|
||||
<controls:MainControl/>
|
||||
<NativeMenu.Menu>
|
||||
<NativeMenu>
|
||||
<NativeMenuItem Header="File">
|
||||
<NativeMenuItem.Menu>
|
||||
<NativeMenu>
|
||||
<NativeMenuItem Header="Exit" Gesture="cmd+e" Command="{Binding FileExitCommand}"/>
|
||||
</NativeMenu>
|
||||
</NativeMenuItem.Menu>
|
||||
</NativeMenuItem>
|
||||
<NativeMenuItem Header="Theme">
|
||||
<NativeMenuItem.Menu>
|
||||
<NativeMenu>
|
||||
<NativeMenuItem Header="Default Light" IsEnabled="{Binding DefaultLightEnabled}" Command="{Binding DefaultLightMethod}"/>
|
||||
<NativeMenuItem Header="Default Dark" IsEnabled="{Binding DefaultDarkEnabled}" Command="{Binding DefaultDarkMethod}"/>
|
||||
<NativeMenuItem Header="Fluent Light" IsEnabled="{Binding FluentLightEnabled}" Command="{Binding FluentLightMethod}"/>
|
||||
<NativeMenuItem Header="Fluent Dark" IsEnabled="{Binding FluentDarkEnabled}" Command="{Binding FluentDarkMethod}"/>
|
||||
</NativeMenu>
|
||||
</NativeMenuItem.Menu>
|
||||
</NativeMenuItem>
|
||||
</NativeMenu>
|
||||
</NativeMenu.Menu>
|
||||
</Window>
|
@ -1,28 +0,0 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
|
||||
using AvaloniaCoreRTDemo.Interfaces;
|
||||
using AvaloniaCoreRTDemo.Windows.ViewModels;
|
||||
|
||||
namespace AvaloniaCoreRTDemo.Windows
|
||||
{
|
||||
public partial class MainWindowMacOS : Window, IMainWindow
|
||||
{
|
||||
public MainWindowMacOS()
|
||||
{
|
||||
InitializeComponent();
|
||||
#if DEBUG
|
||||
this.AttachDevTools();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
this.DataContext = new MainViewModel<MainWindowMacOS>(this);
|
||||
}
|
||||
|
||||
IThemeSwitch IMainWindow.ThemeSwitch => App.Current as IThemeSwitch;
|
||||
}
|
||||
}
|
@ -51,8 +51,8 @@ namespace AvaloniaCoreRTDemo.Windows.ViewModels
|
||||
this.ChangeTheme(window.ThemeSwitch.Current);
|
||||
}
|
||||
|
||||
public void DefaultLightMethod() => this.ChangeTheme(ApplicationTheme.DefaultLight);
|
||||
public void DefaultDarkMethod() => this.ChangeTheme(ApplicationTheme.DefaultDark);
|
||||
public void DefaultLightMethod() => this.ChangeTheme(ApplicationTheme.SimpleLight);
|
||||
public void DefaultDarkMethod() => this.ChangeTheme(ApplicationTheme.SimpleDark);
|
||||
public void FluentLightMethod() => this.ChangeTheme(ApplicationTheme.FluentLight);
|
||||
public void FluentDarkMethod() => this.ChangeTheme(ApplicationTheme.FluentDark);
|
||||
public override void HelpAboutMethod() => base.RunHelpAbout(this._window);
|
||||
@ -62,8 +62,8 @@ namespace AvaloniaCoreRTDemo.Windows.ViewModels
|
||||
|
||||
private void ChangeTheme(ApplicationTheme theme)
|
||||
{
|
||||
this.DefaultLightEnabled = theme != ApplicationTheme.DefaultLight && theme != ApplicationTheme.FluentLight;
|
||||
this.DefaultDarkEnabled = theme != ApplicationTheme.DefaultDark && theme != ApplicationTheme.FluentDark;
|
||||
this.DefaultLightEnabled = theme != ApplicationTheme.SimpleLight && theme != ApplicationTheme.FluentLight;
|
||||
this.DefaultDarkEnabled = theme != ApplicationTheme.SimpleDark && theme != ApplicationTheme.FluentDark;
|
||||
this.FluentLightEnabled = theme != ApplicationTheme.FluentLight;
|
||||
this.FluentDarkEnabled = theme != ApplicationTheme.FluentDark;
|
||||
this._window.ThemeSwitch?.ChangeTheme(theme);
|
||||
|
@ -41,7 +41,7 @@ namespace AvaloniaCoreRTDemo.Windows.ViewModels
|
||||
private static Boolean IsDarkTheme(ApplicationTheme? theme)
|
||||
=> theme switch
|
||||
{
|
||||
ApplicationTheme.DefaultDark => true,
|
||||
ApplicationTheme.SimpleDark => true,
|
||||
ApplicationTheme.FluentDark => true,
|
||||
_ => false,
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user