104 lines
4.7 KiB
XML
104 lines
4.7 KiB
XML
<Window x:Class="PMSWPF.Views.MainView"
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
xmlns:ui="http://schemas.inkore.net/lib/ui/wpf/modern"
|
|
xmlns:local="clr-namespace:PMSWPF.Views"
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
xmlns:vm="clr-namespace:PMSWPF.ViewModels"
|
|
xmlns:mo="clr-namespace:PMSWPF.Models"
|
|
xmlns:hc="https://handyorg.github.io/handycontrol"
|
|
Title="设备管理系统"
|
|
Width="1080"
|
|
Height="800"
|
|
WindowStartupLocation="CenterScreen"
|
|
WindowState="Maximized"
|
|
Loaded="MainView_OnLoaded"
|
|
ui:WindowHelper.UseModernWindowStyle="True"
|
|
ui:WindowHelper.SystemBackdropType="Mica"
|
|
d:DataContext="{d:DesignInstance vm:MainViewModel}"
|
|
mc:Ignorable="d">
|
|
<Window.Resources>
|
|
|
|
<ContextMenu x:Key="MyMenuItemContextMenu">
|
|
<MenuItem Header="添加" />
|
|
<MenuItem Header="编辑" />
|
|
<Separator />
|
|
<MenuItem Header="删除" />
|
|
</ContextMenu>
|
|
<DataTemplate x:Key="NavigationViewMenuItem"
|
|
DataType="{x:Type mo:MenuBean}">
|
|
<ui:NavigationViewItem
|
|
Content="{Binding Name}"
|
|
MenuItemsSource="{Binding Items }">
|
|
<ui:NavigationViewItem.Icon>
|
|
<ui:FontIcon Glyph="{Binding Icon}" />
|
|
</ui:NavigationViewItem.Icon>
|
|
</ui:NavigationViewItem>
|
|
</DataTemplate>
|
|
</Window.Resources>
|
|
<Grid>
|
|
<ui:NavigationView ExpandedModeThresholdWidth="500"
|
|
IsTabStop="False"
|
|
PaneDisplayMode="Left"
|
|
PaneTitle="设备管理系统"
|
|
IsSettingsVisible="False"
|
|
AlwaysShowHeader="True"
|
|
IsBackButtonVisible="Collapsed"
|
|
IsBackEnabled="False"
|
|
SelectionFollowsFocus="Disabled"
|
|
MenuItemsSource="{Binding Menus}"
|
|
MenuItemTemplate="{StaticResource NavigationViewMenuItem}"
|
|
SelectionChanged="NavigationView_SelectionChanged">
|
|
|
|
<ui:NavigationView.AutoSuggestBox>
|
|
<ui:AutoSuggestBox AutomationProperties.Name="Search">
|
|
<ui:AutoSuggestBox.QueryIcon>
|
|
<ui:FontIcon Icon="{x:Static ui:SegoeFluentIcons.Search}" />
|
|
</ui:AutoSuggestBox.QueryIcon>
|
|
</ui:AutoSuggestBox>
|
|
</ui:NavigationView.AutoSuggestBox>
|
|
|
|
|
|
<Grid>
|
|
<!-- 数据模版绑定不同的View显示 -->
|
|
<ContentControl Content="{Binding CurrentViewModel}">
|
|
<ContentControl.Resources>
|
|
<!-- 主页 -->
|
|
<DataTemplate DataType="{x:Type vm:HomeViewModel}">
|
|
<local:HomeView />
|
|
</DataTemplate>
|
|
<!-- 设备列表页 -->
|
|
<DataTemplate DataType="{x:Type vm:DevicesViewModel}">
|
|
<local:DevicesView />
|
|
</DataTemplate>
|
|
<!-- 数据转换页 -->
|
|
<DataTemplate DataType="{x:Type vm:DataTransformViewModel}">
|
|
<local:DataTransformView />
|
|
</DataTemplate>
|
|
<!-- 设置页 -->
|
|
<DataTemplate DataType="{x:Type vm:SettingViewModel}">
|
|
<local:SettingView />
|
|
</DataTemplate>
|
|
<!-- 设备详情页 -->
|
|
<DataTemplate DataType="{x:Type vm:DeviceDetailViewModel}">
|
|
<local:DeviceDetailView />
|
|
</DataTemplate>
|
|
<!-- 设备变量页 -->
|
|
<DataTemplate DataType="{x:Type vm:VariableTableViewModel}">
|
|
<local:VariableTableView />
|
|
</DataTemplate>
|
|
</ContentControl.Resources>
|
|
</ContentControl>
|
|
|
|
<ScrollViewer VerticalScrollBarVisibility="Hidden"
|
|
HorizontalAlignment="Right">
|
|
<StackPanel hc:Growl.GrowlParent="True"
|
|
VerticalAlignment="Top"
|
|
Margin="0,10,10,10" />
|
|
</ScrollViewer>
|
|
</Grid>
|
|
|
|
</ui:NavigationView>
|
|
</Grid>
|
|
</Window> |