4 changed files with 34 additions and 45 deletions
@ -1,38 +1,19 @@ |
|||||
<Application xmlns="https://github.com/avaloniaui" |
<Application xmlns="https://github.com/avaloniaui" |
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
xmlns:vm="using:ControlCatalog.ViewModels" |
||||
|
x:DataType="vm:ApplicationViewModel" |
||||
|
x:CompileBindings="True" |
||||
x:Class="ControlCatalog.App"> |
x:Class="ControlCatalog.App"> |
||||
|
|
||||
<TrayIcon.TrayIcons> |
<TrayIcon.TrayIcons> |
||||
<TrayIcons> |
<TrayIcons> |
||||
<TrayIcon Icon="/Assets/test_icon.ico" ToolTipText="Avalonia Tray Icon ToolTip"> |
<TrayIcon Icon="/Assets/test_icon.ico" ToolTipText="Avalonia Tray Icon ToolTip"> |
||||
<NativeMenu.Menu> |
<NativeMenu.Menu> |
||||
<NativeMenu> |
<NativeMenu> |
||||
<NativeMenuItem Header="About" /> |
<NativeMenuItem Header="Exit" Command="{Binding ExitCommand}" /> |
||||
</NativeMenu> |
</NativeMenu> |
||||
</NativeMenu.Menu> |
</NativeMenu.Menu> |
||||
</TrayIcon> |
</TrayIcon> |
||||
</TrayIcons> |
</TrayIcons> |
||||
</TrayIcon.TrayIcons> |
</TrayIcon.TrayIcons> |
||||
<Application.Styles> |
|
||||
<Style Selector="TextBlock.h1"> |
|
||||
<Setter Property="FontSize" Value="16" /> |
|
||||
<Setter Property="FontWeight" Value="Medium" /> |
|
||||
</Style> |
|
||||
<Style Selector="TextBlock.h2"> |
|
||||
<Setter Property="FontSize" Value="14" /> |
|
||||
</Style> |
|
||||
<Style Selector="TextBlock.h3"> |
|
||||
<Setter Property="FontSize" Value="12" /> |
|
||||
</Style> |
|
||||
<Style Selector="Label.h1"> |
|
||||
<Setter Property="FontSize" Value="16" /> |
|
||||
<Setter Property="FontWeight" Value="Medium" /> |
|
||||
</Style> |
|
||||
<Style Selector="Label.h2"> |
|
||||
<Setter Property="FontSize" Value="14" /> |
|
||||
</Style> |
|
||||
<Style Selector="Label.h3"> |
|
||||
<Setter Property="FontSize" Value="12" /> |
|
||||
</Style> |
|
||||
<StyleInclude Source="/SideBar.xaml"/> |
|
||||
</Application.Styles> |
|
||||
</Application> |
</Application> |
||||
|
|||||
@ -0,0 +1,22 @@ |
|||||
|
using Avalonia; |
||||
|
using Avalonia.Controls.ApplicationLifetimes; |
||||
|
using MiniMvvm; |
||||
|
|
||||
|
namespace ControlCatalog.ViewModels |
||||
|
{ |
||||
|
public class ApplicationViewModel : ViewModelBase |
||||
|
{ |
||||
|
public ApplicationViewModel() |
||||
|
{ |
||||
|
ExitCommand = MiniCommand.Create(() => |
||||
|
{ |
||||
|
if(Application.Current.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime lifetime) |
||||
|
{ |
||||
|
lifetime.Shutdown(); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
public MiniCommand ExitCommand { get; } |
||||
|
} |
||||
|
} |
||||
Loading…
Reference in new issue