mirror of
https://github.com/aaru-dps/Aaru.git
synced 2026-07-08 18:16:24 +00:00
Add menu to MainWindow.
This commit is contained in:
@@ -10,4 +10,12 @@
|
||||
<StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/>
|
||||
<StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/>
|
||||
</Application.Styles>
|
||||
|
||||
<NativeMenu.Menu>
|
||||
<NativeMenu>
|
||||
<NativeMenuItem Header="_About"/>
|
||||
<NativeMenuItem Header="_Preferences"/>
|
||||
<NativeMenuItem Header="_Quit"/>
|
||||
</NativeMenu>
|
||||
</NativeMenu.Menu>
|
||||
</Application>
|
||||
|
||||
@@ -1,7 +1,15 @@
|
||||
namespace Aaru.Gui.ViewModels
|
||||
using System;
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Controls.ApplicationLifetimes;
|
||||
|
||||
namespace Aaru.Gui.ViewModels
|
||||
{
|
||||
public class MainWindowViewModel : ViewModelBase
|
||||
{
|
||||
public string Greeting => "Welcome to Aaru!";
|
||||
|
||||
public bool NativeMenuNotSupported => !NativeMenu.GetIsNativeMenuExported((Application.Current.ApplicationLifetime as
|
||||
IClassicDesktopStyleApplicationLifetime)?.MainWindow);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,30 @@
|
||||
<vm:MainWindowViewModel/>
|
||||
</Design.DataContext>
|
||||
|
||||
<TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<DockPanel>
|
||||
<Menu DockPanel.Dock="Top">
|
||||
<MenuItem Header="_File">
|
||||
<MenuItem Header="_Open"/>
|
||||
<Separator/>
|
||||
<MenuItem Header="_Settings" IsVisible="{Binding NativeMenuNotSupported}"/>
|
||||
<Separator/>
|
||||
<MenuItem Header="E_xit" IsVisible="{Binding NativeMenuNotSupported}"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Devices">
|
||||
<MenuItem Header="_Refresh"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Window">
|
||||
<MenuItem Header="_Console"/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Help">
|
||||
<MenuItem Header="_Encodings"/>
|
||||
<MenuItem Header="_Plugins"/>
|
||||
<MenuItem Header="_Statistics"/>
|
||||
<Separator IsVisible="{Binding NativeMenuNotSupported}"/>
|
||||
<MenuItem Header="_About" Name="AboutMenuItem" IsVisible="{Binding NativeMenuNotSupported}"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
<TextBlock Text="{Binding Greeting}" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
</DockPanel>
|
||||
|
||||
</Window>
|
||||
|
||||
Reference in New Issue
Block a user