终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

215 lines
9.3 KiB

  1. <Window
  2. x:Class="BPASmart.ConfigurationSoftware.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:local="clr-namespace:BPASmart.ConfigurationSoftware"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. Title="MainWindow"
  9. WindowState="Maximized"
  10. Width="800"
  11. Height="450"
  12. Topmost="False"
  13. WindowStartupLocation="CenterScreen"
  14. mc:Ignorable="d">
  15. <Window.DataContext>
  16. <local:MainWindowViewModel />
  17. </Window.DataContext>
  18. <Window.Resources>
  19. <!--#region 下拉列表单选按钮样式-->
  20. <Style x:Key="RadioMiniButtonStyle" TargetType="{x:Type RadioButton}">
  21. <Setter Property="Margin" Value="20,1,1,1" />
  22. <!--<Setter Property="Width" Value="160" />-->
  23. <!--<Setter Property="Height" Value="30" />-->
  24. <Setter Property="FontSize" Value="14" />
  25. <Setter Property="FontFamily" Value="粗体" />
  26. <Setter Property="VerticalContentAlignment" Value="Center" />
  27. <Setter Property="HorizontalContentAlignment" Value="left" />
  28. <Setter Property="BorderBrush" Value="Transparent" />
  29. <Setter Property="BorderThickness" Value="0" />
  30. <Setter Property="Background" Value="#ddd" />
  31. <Setter Property="HorizontalAlignment" Value="left" />
  32. <Setter Property="Template">
  33. <Setter.Value>
  34. <ControlTemplate TargetType="{x:Type RadioButton}">
  35. <Grid
  36. x:Name="templateRoot"
  37. Background="Transparent"
  38. SnapsToDevicePixels="True">
  39. <Border x:Name="border2" />
  40. <ContentPresenter
  41. x:Name="contentPresenter"
  42. Margin="{TemplateBinding Padding}"
  43. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  44. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  45. Content="{TemplateBinding Content}"
  46. ContentStringFormat="{TemplateBinding ContentStringFormat}"
  47. ContentTemplate="{TemplateBinding ContentTemplate}"
  48. Focusable="False"
  49. RecognizesAccessKey="True"
  50. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  51. </Grid>
  52. <ControlTemplate.Triggers>
  53. <Trigger Property="HasContent" Value="True">
  54. <Setter Property="FocusVisualStyle">
  55. <Setter.Value>
  56. <Style>
  57. <Setter Property="Control.Template">
  58. <Setter.Value>
  59. <ControlTemplate>
  60. <Rectangle
  61. Margin="14,0,0,0"
  62. SnapsToDevicePixels="True"
  63. Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
  64. StrokeDashArray="1 2"
  65. StrokeThickness="1" />
  66. </ControlTemplate>
  67. </Setter.Value>
  68. </Setter>
  69. </Style>
  70. </Setter.Value>
  71. </Setter>
  72. <Setter Property="Padding" Value="4,-1,0,0" />
  73. </Trigger>
  74. <Trigger Property="IsChecked" Value="{x:Null}" />
  75. <Trigger Property="IsChecked" Value="true">
  76. <!--<Setter Property="Foreground" Value="White" />-->
  77. <Setter TargetName="border2" Property="Background" Value="red" />
  78. </Trigger>
  79. <Trigger Property="IsChecked" Value="false">
  80. <Setter TargetName="border2" Property="Background" Value="Transparent" />
  81. <!--<Setter Property="Foreground" Value="#4B8EC4" />-->
  82. </Trigger>
  83. <MultiTrigger>
  84. <MultiTrigger.Conditions>
  85. <Condition Property="IsChecked" Value="false" />
  86. <Condition Property="IsMouseOver" Value="True" />
  87. </MultiTrigger.Conditions>
  88. <MultiTrigger.Setters>
  89. <Setter TargetName="border2" Property="Background" Value="#55007acc" />
  90. </MultiTrigger.Setters>
  91. </MultiTrigger>
  92. </ControlTemplate.Triggers>
  93. </ControlTemplate>
  94. </Setter.Value>
  95. </Setter>
  96. </Style>
  97. <!--#endregion-->
  98. </Window.Resources>
  99. <Grid>
  100. <Grid.RowDefinitions>
  101. <RowDefinition Height="30" />
  102. <RowDefinition />
  103. </Grid.RowDefinitions>
  104. <StackPanel Orientation="Horizontal">
  105. <Button
  106. Width="60"
  107. Margin="5"
  108. Command="{Binding NewProjectCommand}"
  109. Content="新建" />
  110. <Button
  111. Width="60"
  112. Margin="5"
  113. Command="{Binding SaveProjectCommand}"
  114. Content="保存" />
  115. <Button
  116. Width="60"
  117. Margin="5"
  118. Command="{Binding}"
  119. Content="打开" />
  120. <Button
  121. Width="60"
  122. Margin="5"
  123. Content="运行" />
  124. <Button
  125. Width="60"
  126. Margin="5"
  127. Command="{Binding OpenVarManagerCommand}"
  128. Content="变量管理" />
  129. </StackPanel>
  130. <Grid Grid.Row="1">
  131. <Grid.ColumnDefinitions>
  132. <ColumnDefinition Width="150" />
  133. <ColumnDefinition />
  134. </Grid.ColumnDefinitions>
  135. <Grid>
  136. <Grid.RowDefinitions>
  137. <RowDefinition Height="20" />
  138. <RowDefinition />
  139. </Grid.RowDefinitions>
  140. <TextBlock
  141. Margin="5,0,0,0"
  142. HorizontalAlignment="Left"
  143. VerticalAlignment="Center"
  144. Text="{Binding Head}">
  145. <TextBlock.ContextMenu>
  146. <ContextMenu>
  147. <MenuItem Command="{Binding NewPageCommand}" Header="新建页面" />
  148. </ContextMenu>
  149. </TextBlock.ContextMenu>
  150. </TextBlock>
  151. <ScrollViewer
  152. Grid.Row="1"
  153. HorizontalScrollBarVisibility="Hidden"
  154. VerticalScrollBarVisibility="Hidden">
  155. <ItemsControl ItemsSource="{Binding Pages}">
  156. <ItemsControl.ItemTemplate>
  157. <DataTemplate>
  158. <Grid>
  159. <RadioButton
  160. Command="{Binding DataContext.SelectedPageCommand, RelativeSource={RelativeSource AncestorType=Window, Mode=FindAncestor}}"
  161. CommandParameter="{Binding}"
  162. Content="{Binding}"
  163. GroupName="All"
  164. Style="{StaticResource RadioMiniButtonStyle}">
  165. <RadioButton.ContextMenu>
  166. <ContextMenu>
  167. <MenuItem Header="删除页面" />
  168. <MenuItem Header="设为启动界面" />
  169. <MenuItem Header="重命名" />
  170. </ContextMenu>
  171. </RadioButton.ContextMenu>
  172. </RadioButton>
  173. </Grid>
  174. </DataTemplate>
  175. </ItemsControl.ItemTemplate>
  176. </ItemsControl>
  177. </ScrollViewer>
  178. </Grid>
  179. <ContentControl
  180. Grid.Row="1"
  181. Grid.Column="1"
  182. Width="auto"
  183. Height="auto"
  184. Content="{Binding MainContent}" />
  185. <!--<Canvas Name="cav" Grid.Column="1" Grid.Row="1">
  186. </Canvas>-->
  187. </Grid>
  188. </Grid>
  189. </Window>