Files
WCS/Cowain.TestProject/Views/MainWindow.axaml
2026-03-02 09:08:20 +08:00

89 lines
3.1 KiB
XML

<u:UrsaWindow
x:Class="Cowain.TestProject.Views.MainWindow"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:extensions="using:Cowain.Base.Extensions"
xmlns:i18n="clr-namespace:Ke.Bee.Localization.Extensions;assembly=Ke.Bee.Localization"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:menu="using:Cowain.Base.ViewModels"
xmlns:u="https://irihi.tech/ursa"
xmlns:view="using:Cowain.TestProject.Views"
xmlns:views="using:Cowain.TestProject.Views"
xmlns:vm="using:Cowain.TestProject.ViewModels"
Title="{i18n:Localize AppName}"
Width="1024"
Height="600"
MinWidth="1024"
MinHeight="500"
d:DesignHeight="450"
d:DesignWidth="800"
x:CompileBindings="True"
x:DataType="vm:MainWindowViewModel"
Icon="/Assets/CowainLogo.ico"
IsFullScreenButtonVisible="{OnPlatform True,
macOS=False}"
IsManagedResizerVisible="{OnPlatform False,
Linux=True}"
mc:Ignorable="d">
<u:UrsaWindow.RightContent>
<StackPanel Orientation="Horizontal" Spacing="10">
<StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
<StackPanel.Styles>
<Style Selector="Button">
<Setter Property="Theme" Value="{DynamicResource BorderlessButton}" />
<Setter Property="Padding" Value="8" />
<Setter Property="Foreground" Value="{DynamicResource ButtonDefaultTertiaryForeground}" />
</Style>
<Style Selector="PathIcon">
<Setter Property="Theme" Value="{DynamicResource InnerPathIcon}" />
</Style>
</StackPanel.Styles>
<TextBlock VerticalAlignment="Center" Text="{extensions:GlobalDataExtensions CurrentUser, Name}" />
<ToggleSwitch
Command="{Binding ToggleThemeCommand}"
Foreground="{DynamicResource ButtonDefaultTertiaryForeground}"
OffContent="{StaticResource SemiIconSun}"
OnContent="{StaticResource SemiIconMoon}"
Theme="{DynamicResource ThemeToggleSwitch}" />
<!-- 设置菜单 -->
<ItemsControl DockPanel.Dock="Bottom" ItemsSource="{Binding SettingMenus}">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button Classes="ToolbarIconButton">
<PathIcon Data="{StaticResource SemiIconMenu}" />
<Button.Flyout>
<MenuFlyout ItemsSource="{Binding Items}" Placement="Top">
<MenuFlyout.ItemContainerTheme>
<ControlTheme
x:DataType="menu:MenuItemViewModel"
BasedOn="{StaticResource {x:Type MenuItem}}"
TargetType="MenuItem">
<Setter Property="Header" Value="{Binding Text}" />
<Setter Property="ItemsSource" Value="{Binding Items}" />
<Setter Property="Icon" Value="{Binding Icon}" />
<Setter Property="Command" Value="{Binding MenuClickCommand}" />
<Setter Property="CommandParameter" Value="{Binding}" />
</ControlTheme>
</MenuFlyout.ItemContainerTheme>
</MenuFlyout>
</Button.Flyout>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</StackPanel>
</StackPanel>
</u:UrsaWindow.RightContent>
<views:MainView />
</u:UrsaWindow>