Files
CapMachine/CapMachine.Wpf/Views/MainView.xaml
2026-02-02 21:22:01 +08:00

220 lines
11 KiB
XML

<Window
x:Class="CapMachine.Wpf.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:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:local="clr-namespace:CapMachine.Wpf.Views"
xmlns:localEx="clr-namespace:CapMachine.Wpf"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:prism="http://prismlibrary.com/"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
Title="压缩机耐久测试平台"
Width="1920"
Height="1080"
prism:ViewModelLocator.AutoWireViewModel="True"
Closed="Window_Closed"
Closing="Window_Closing"
Icon="/Assets/Images/favicon.ico"
StateChanged="Window_StateChanged"
WindowStartupLocation="CenterScreen"
WindowState="Maximized"
WindowStyle="SingleBorderWindow"
mc:Ignorable="d">
<Window.Resources>
<localEx:BindingProxy x:Key="Proxy" Data="{Binding}" />
</Window.Resources>
<!--<i:Interaction.Triggers>
<i:EventTrigger EventName="StateChanged">
<prism:InvokeCommandAction Command="{Binding WindowStateChangedCmd}" CommandParameter="{Binding ElementName=MainDatagrid, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>-->
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="50" />
<RowDefinition />
<RowDefinition Height="30" />
</Grid.RowDefinitions>
<md:ColorZone md:ElevationAssist.Elevation="Dp2" Mode="PrimaryDark">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<StackPanel Margin="15" Orientation="Horizontal">
<TextBlock
Margin="5,0,15,0"
VerticalAlignment="Center"
FontSize="22"
FontWeight="Bold"
Text="压缩机耐久测试软件平台" />
</StackPanel>
<ListBox
x:Name="listBox"
Grid.Column="1"
ItemsSource="{Binding MenuService.MenuItems}"
SelectedIndex="{Binding SelectedIndex}">
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ListBox.ItemsPanel>
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Setter Property="FocusVisualStyle" Value="{x:Null}" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ListBoxItem">
<Grid>
<Border x:Name="border" />
<Border x:Name="borderheader" Background="{TemplateBinding Background}" />
<ContentPresenter
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
TextBlock.Foreground="{TemplateBinding Foreground}" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsSelected" Value="true">
<Setter TargetName="borderheader" Property="Background" Value="#ffffff" />
<Setter TargetName="borderheader" Property="Opacity" Value="0.1" />
<Setter TargetName="border" Property="BorderBrush" Value="#ffffff" />
<Setter TargetName="border" Property="BorderThickness" Value="0,0,0,3" />
</Trigger>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="borderheader" Property="Background" Value="#ffffff" />
<Setter TargetName="borderheader" Property="Opacity" Value="0.1" />
<Setter TargetName="border" Property="BorderBrush" Value="#ffffff" />
<Setter TargetName="border" Property="BorderThickness" Value="0,0,0,3" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="10,0,0,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="14"
Foreground="White"
Text="&#xe92c;" />
<TextBlock
Margin="3,5,10,5"
FontSize="16"
FontWeight="Bold"
Foreground="White"
Text="{Binding Name}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding NavigateCommand}" CommandParameter="{Binding ElementName=listBox, Path=SelectedItem}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</ListBox>
<StackPanel
Grid.Column="2"
Margin="20,0"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
Margin="0,0,5,0"
VerticalAlignment="Center"
FontFamily="/Assets/Fonts/#iconfont"
FontSize="20"
Foreground="White"
Text="&#xe906;" />
<TextBlock FontSize="18" Text="{Binding SysService.CurDateTime, StringFormat={}{0:MM-dd HH:mm}}" />
</StackPanel>
</Grid>
</md:ColorZone>
<md:DialogHost Grid.Row="1">
<!-- Content="{Binding ElementName=MainViewContentControl, Path=Content, Mode=TwoWay}" IsTopDrawerOpen="{Binding IsTopDrawerOpen}" -->
<md:DrawerHost Content="{Binding ElementName=MainViewContentControl, Path=Content, Mode=TwoWay}" IsTopDrawerOpen="{Binding IsTopDrawerOpen}">
<md:DrawerHost.TopDrawerContent>
<ItemsControl Padding="0,5,0,20" ItemsSource="{Binding MenuService.MenuItems[0].Items}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<WrapPanel />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Margin="15,10" Orientation="Horizontal">
<TextBlock
Margin="5,0"
VerticalAlignment="Center"
FontSize="24"
FontWeight="Bold"
Foreground="BlueViolet"
Text="{Binding Name}" />
</StackPanel>
<ItemsControl
Grid.Row="1"
Margin="10,0"
VerticalAlignment="Top"
ItemsSource="{Binding Items}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<UniformGrid VerticalAlignment="Center" Columns="2" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Button
Height="40"
Margin="5"
Command="{Binding Source={StaticResource Proxy}, Path=Data.TopDrawerCmd}"
CommandParameter="{Binding Name}">
<StackPanel Orientation="Horizontal">
<TextBlock Margin="10,5" Text="{Binding Name}" />
</StackPanel>
</Button>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</md:DrawerHost.TopDrawerContent>
</md:DrawerHost>
</md:DialogHost>
<ContentControl
x:Name="MainViewContentControl"
prism:RegionManager.RegionName="MainViewContentRegion"
Visibility="Collapsed" />
<ContentControl
x:Name="MainViewFooterContentControl"
Grid.Row="2"
prism:RegionManager.RegionName="MainViewFooterContentRegion" />
</Grid>
</Window>