WIn_RustTools/RustTools/Views/ShellPage.xaml
2024-07-14 19:24:10 +08:00

85 lines
3.7 KiB
XML

<Page
x:Class="RustTools.Views.ShellPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:behaviors="using:RustTools.Behaviors"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:helpers="using:RustTools.Helpers"
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Loaded="OnLoaded">
<Grid>
<Grid
x:Name="AppTitleBar"
Height="{Binding ElementName=NavigationViewControl, Path=CompactPaneLength}"
VerticalAlignment="Top"
Canvas.ZIndex="1"
IsHitTestVisible="True">
<Image
Width="16"
Height="16"
HorizontalAlignment="Left"
Source="/Assets/WindowIcon.ico" />
<TextBlock
x:Name="AppTitleBarText"
Margin="28,0,0,0"
VerticalAlignment="Center"
Style="{StaticResource CaptionTextBlockStyle}"
TextWrapping="NoWrap" />
</Grid>
<NavigationView
x:Name="NavigationViewControl"
Canvas.ZIndex="0"
DisplayModeChanged="NavigationViewControl_DisplayModeChanged"
ExpandedModeThresholdWidth="1280"
Header="{x:Bind ((ContentControl)ViewModel.Selected).Content, Mode=OneWay}"
IsBackButtonVisible="Visible"
IsBackEnabled="{x:Bind ViewModel.IsBackEnabled, Mode=OneWay}"
IsSettingsVisible="True"
SelectedItem="{x:Bind ViewModel.Selected, Mode=OneWay}">
<NavigationView.MenuItems>
<NavigationViewItem
x:Uid="HomePage"
helpers:NavigationHelper.NavigateTo="RustTools.ViewModels.HomePageViewModel"
Icon="Home" />
<NavigationViewItem
x:Uid="Concern"
helpers:NavigationHelper.NavigateTo="RustTools.ViewModels.MainViewModel"
Icon="Contact" />
<NavigationViewItem
x:Uid="Ranking"
helpers:NavigationHelper.NavigateTo="RustTools.ViewModels.MainViewModel"
Icon="List" />
<NavigationViewItem
x:Uid="User"
helpers:NavigationHelper.NavigateTo="RustTools.ViewModels.MainViewModel"
Icon="Contact2" />
</NavigationView.MenuItems>
<NavigationView.HeaderTemplate>
<DataTemplate>
<Grid>
<TextBlock Style="{ThemeResource TitleTextBlockStyle}" Text="{Binding}" />
</Grid>
</DataTemplate>
</NavigationView.HeaderTemplate>
<i:Interaction.Behaviors>
<behaviors:NavigationViewHeaderBehavior DefaultHeader="{x:Bind ((ContentControl)ViewModel.Selected).Content, Mode=OneWay}">
<behaviors:NavigationViewHeaderBehavior.DefaultHeaderTemplate>
<DataTemplate>
<Grid>
<TextBlock Style="{ThemeResource TitleTextBlockStyle}" Text="{Binding}" />
</Grid>
</DataTemplate>
</behaviors:NavigationViewHeaderBehavior.DefaultHeaderTemplate>
</behaviors:NavigationViewHeaderBehavior>
</i:Interaction.Behaviors>
<Grid Margin="{StaticResource NavigationViewPageContentMargin}">
<Frame x:Name="NavigationFrame" />
</Grid>
</NavigationView>
</Grid>
</Page>