25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
4.7 KiB

  1. <Window
  2. x:Class="ModbusDemo.MainWindow"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  7. xmlns:local="clr-namespace:ModbusDemo"
  8. xmlns:md="http://materialdesigninxaml.net/winfx/xaml/themes"
  9. xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
  10. xmlns:prism="http://prismlibrary.com/"
  11. xmlns:viewmodel="clr-namespace:ModbusDemo.VIewModel"
  12. d:DataContext="{d:DesignInstance Type=viewmodel:MainWindowViewModel,IsDesignTimeCreatable=True}"
  13. Title="MainWindow"
  14. Width="900"
  15. Height="600"
  16. WindowStartupLocation="CenterScreen"
  17. mc:Ignorable="d">
  18. <WindowChrome.WindowChrome>
  19. <WindowChrome GlassFrameThickness="-1"></WindowChrome>
  20. </WindowChrome.WindowChrome>
  21. <md:DialogHost DialogTheme="Inherit" Identifier="RootDialog">
  22. <md:DrawerHost x:Name="drawerHost" IsLeftDrawerOpen="{Binding ElementName=MenuToggleButton, Path=IsChecked}">
  23. <!-- 菜单 -->
  24. <md:DrawerHost.LeftDrawerContent>
  25. <DockPanel MinWidth="220">
  26. <StackPanel Margin="0,20" DockPanel.Dock="Top">
  27. </StackPanel>
  28. <!-- 菜单列表 -->
  29. <ListBox x:Name="lbMenu" ItemsSource="{Binding LeftMenusList}" ItemContainerStyle="{StaticResource LeftMenuStyle}" SelectionChanged="lbMenu_SelectionChanged">
  30. <i:Interaction.Triggers>
  31. <i:EventTrigger EventName="SelectionChanged">
  32. <i:InvokeCommandAction Command="{Binding NavigationCmm}" CommandParameter="{Binding SelectedItem, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}}">
  33. </i:InvokeCommandAction>
  34. </i:EventTrigger>
  35. </i:Interaction.Triggers>
  36. <ListBox.ItemTemplate>
  37. <DataTemplate>
  38. <StackPanel Orientation="Horizontal" Background="Transparent" >
  39. <md:PackIcon Margin="15,0" HorizontalAlignment="Center" VerticalAlignment="Center" Kind="{Binding Icon}" FontSize="20">
  40. </md:PackIcon>
  41. <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center" Text="{Binding MenuName}" FontSize="20">
  42. </TextBlock>
  43. </StackPanel>
  44. </DataTemplate>
  45. </ListBox.ItemTemplate>
  46. </ListBox>
  47. </DockPanel>
  48. </md:DrawerHost.LeftDrawerContent>
  49. <!-- 头部 -->
  50. <DockPanel>
  51. <md:ColorZone
  52. Padding="16"
  53. md:ElevationAssist.Elevation="Dp4"
  54. MouseDoubleClick="ColorZone_MouseDoubleClick"
  55. DockPanel.Dock="Top"
  56. Mode="PrimaryMid">
  57. <DockPanel LastChildFill="True">
  58. <StackPanel DockPanel.Dock="Right" Orientation="Horizontal">
  59. <Button x:Name="btnMin" Content="—" Style="{StaticResource MaterialDesignFlatMidBgButton}" Click="btnMin_Click" />
  60. <Button x:Name="btnMax" Content="☐" Style="{StaticResource MaterialDesignFlatMidBgButton}" Click="btnMax_Click" />
  61. <Button x:Name="btnClose" Content="✕" Style="{StaticResource MaterialDesignFlatMidBgButton}" Click="btnClose_Click" />
  62. </StackPanel>
  63. <StackPanel Orientation="Horizontal">
  64. <ToggleButton x:Name="MenuToggleButton" AutomationProperties.Name="HamburgerToggleButton" IsChecked="False" Style="{StaticResource MaterialDesignHamburgerToggleButton}" />
  65. <TextBlock
  66. Margin="15,0"
  67. HorizontalAlignment="Center"
  68. VerticalAlignment="Center"
  69. AutomationProperties.Name="Mat15.0erial Design In XAML Toolkit"
  70. FontSize="22"
  71. Text="ModBus" />
  72. </StackPanel>
  73. </DockPanel>
  74. </md:ColorZone>
  75. <!-- 区域 -->
  76. <ContentControl prism:RegionManager.RegionName="ModbusRegion">
  77. </ContentControl>
  78. </DockPanel>
  79. </md:DrawerHost>
  80. </md:DialogHost>
  81. </Window>