终端一体化运控平台
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.
 
 
 

573 line
44 KiB

  1. <UserControl x:Class="BPASmartClient.CustomResource.Pages.View.VariableConfigView"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:BPASmartClient.CustomResource.Pages.View"
  7. xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
  8. xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"
  9. mc:Ignorable="d"
  10. d:DesignHeight="450" d:DesignWidth="800">
  11. <UserControl.DataContext>
  12. <vm:VariableViewModel/>
  13. </UserControl.DataContext>
  14. <UserControl.Resources>
  15. <Style x:Key="dataGrid" TargetType="DataGrid" >
  16. <Setter Property="HorizontalGridLinesBrush" Value="#FF2AB2E7"/>
  17. <Setter Property="VerticalGridLinesBrush" Value="#FF2AB2E7"/>
  18. <Setter Property="BorderThickness" Value="1"/>
  19. <Setter Property="BorderBrush" Value="#FF2AB2E7"/>
  20. <Setter Property="CanUserResizeColumns" Value="False"/>
  21. <Setter Property="HeadersVisibility" Value="Column"/>
  22. <Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
  23. <Setter Property="VerticalScrollBarVisibility" Value="Hidden"/>
  24. </Style>
  25. <Style x:Key="ColumHeaderStyle" TargetType="DataGridColumnHeader">
  26. <Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
  27. <Setter Property="VerticalAlignment" Value="Center"/>
  28. <Setter Property="Background" Value="#FF2AB2E7"></Setter>
  29. <Setter Property="Foreground" Value="White"></Setter>
  30. <Setter Property="BorderThickness" Value="1"></Setter>
  31. <Setter Property="BorderBrush" Value="white"></Setter>
  32. <Setter Property="Height" Value="30"/>
  33. <Setter Property="FontSize" Value="16"/>
  34. <Setter Property="FontWeight" Value="Heavy"/>
  35. <Setter Property="Margin" Value="-1,-1,-1,-1"/>
  36. </Style>
  37. <Style x:Key="rowStyle" TargetType="DataGridRow">
  38. <Setter Property="Height" Value="35"/>
  39. <Setter Property="Foreground" Value="#FF2AB2E7"/>
  40. <Style.Triggers>
  41. <Trigger Property="AlternationIndex" Value="0">
  42. <Setter Property="Background" Value="Transparent" />
  43. </Trigger>
  44. <Trigger Property="AlternationIndex" Value="1">
  45. <Setter Property="Background" Value="Transparent" />
  46. </Trigger>
  47. <Trigger Property="IsMouseOver" Value="True">
  48. <Setter Property="Background" Value="#000066" />
  49. </Trigger>
  50. </Style.Triggers>
  51. </Style>
  52. <Style x:Key="textboxStyle" TargetType="TextBox">
  53. <Setter Property="Background" Value="Transparent"/>
  54. <Setter Property="Foreground" Value="SkyBlue"/>
  55. <Setter Property="HorizontalContentAlignment" Value="Center"/>
  56. <Setter Property="VerticalContentAlignment" Value="Center"/>
  57. <Setter Property="FontSize" Value="16"/>
  58. <Setter Property="BorderThickness" Value="0"/>
  59. <Setter Property="CaretBrush" Value="LightBlue"/>
  60. <Style.Triggers>
  61. <Trigger Property="IsFocused" Value="True">
  62. <Setter Property="Cursor" Value="Arrow"/>
  63. </Trigger>
  64. </Style.Triggers>
  65. </Style>
  66. <Style x:Key="cellStyle" TargetType="DataGridCell">
  67. <Style.Triggers>
  68. <Trigger Property="IsSelected" Value="True">
  69. <Setter Property="Background" Value="Transparent"/>
  70. <Setter Property="Foreground"
  71. Value="SkyBlue"/>
  72. </Trigger>
  73. <Trigger Property="IsSelected" Value="false">
  74. <Setter Property="Background" Value="Transparent"/>
  75. <Setter Property="Foreground"
  76. Value="SkyBlue"/>
  77. </Trigger>
  78. </Style.Triggers>
  79. </Style>
  80. <Style x:Key="dgCellstyle" TargetType="TextBlock">
  81. <Setter Property="HorizontalAlignment" Value="Center"></Setter>
  82. <Setter Property="VerticalAlignment" Value="Center"/>
  83. <Setter Property="FontSize" Value="16"/>
  84. </Style>
  85. <Style x:Key="FocusVisual">
  86. <Setter Property="Control.Template">
  87. <Setter.Value>
  88. <ControlTemplate>
  89. <Rectangle Margin="2" StrokeDashArray="1 2" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" SnapsToDevicePixels="true" StrokeThickness="1"/>
  90. </ControlTemplate>
  91. </Setter.Value>
  92. </Setter>
  93. </Style>
  94. <SolidColorBrush x:Key="TextBox.Static.Background" Color="#FFFFFFFF"/>
  95. <Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
  96. <Setter Property="OverridesDefaultStyle" Value="true"/>
  97. <Setter Property="AllowDrop" Value="true"/>
  98. <Setter Property="MinWidth" Value="0"/>
  99. <Setter Property="MinHeight" Value="0"/>
  100. <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
  101. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst"/>
  102. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  103. <Setter Property="Template">
  104. <Setter.Value>
  105. <ControlTemplate TargetType="{x:Type TextBox}">
  106. <ScrollViewer x:Name="PART_ContentHost" Background="Transparent" Focusable="false" HorizontalScrollBarVisibility="Hidden" VerticalScrollBarVisibility="Hidden"/>
  107. </ControlTemplate>
  108. </Setter.Value>
  109. </Setter>
  110. </Style>
  111. <LinearGradientBrush x:Key="ComboBox.Static.Background" EndPoint="0,1" StartPoint="0,0">
  112. <GradientStop Color="Transparent" Offset="0.0"/>
  113. <GradientStop Color="Transparent" Offset="1.0"/>
  114. </LinearGradientBrush>
  115. <SolidColorBrush x:Key="ComboBox.Static.Border" Color="#FFACACAC"/>
  116. <SolidColorBrush x:Key="ComboBox.Static.Glyph" Color="#FF2AB2E7"/>
  117. <SolidColorBrush x:Key="ComboBox.Static.Editable.Background" Color="Transparent"/>
  118. <SolidColorBrush x:Key="ComboBox.Static.Editable.Border" Color="#FFABADB3"/>
  119. <SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Background" Color="Transparent"/>
  120. <SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Border" Color="Transparent"/>
  121. <LinearGradientBrush x:Key="ComboBox.MouseOver.Background" EndPoint="0,1" StartPoint="0,0">
  122. <GradientStop Color="Transparent" Offset="0.0"/>
  123. <GradientStop Color="Transparent" Offset="1.0"/>
  124. </LinearGradientBrush>
  125. <SolidColorBrush x:Key="ComboBox.MouseOver.Border" Color="#FF7EB4EA"/>
  126. <SolidColorBrush x:Key="ComboBox.MouseOver.Glyph" Color="#FF000000"/>
  127. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Background" Color="Transparent"/>
  128. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Border" Color="#FF7EB4EA"/>
  129. <LinearGradientBrush x:Key="ComboBox.MouseOver.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0">
  130. <GradientStop Color="Transparent" Offset="0.0"/>
  131. <GradientStop Color="Transparent" Offset="1.0"/>
  132. </LinearGradientBrush>
  133. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Button.Border" Color="#FF7EB4EA"/>
  134. <LinearGradientBrush x:Key="ComboBox.Pressed.Background" EndPoint="0,1" StartPoint="0,0">
  135. <GradientStop Color="#FFDAECFC" Offset="0.0"/>
  136. <GradientStop Color="#FFC4E0FC" Offset="1.0"/>
  137. </LinearGradientBrush>
  138. <SolidColorBrush x:Key="ComboBox.Pressed.Border" Color="#FF569DE5"/>
  139. <SolidColorBrush x:Key="ComboBox.Pressed.Glyph" Color="#FF000000"/>
  140. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Background" Color="#FFFFFFFF"/>
  141. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Border" Color="#FF569DE5"/>
  142. <LinearGradientBrush x:Key="ComboBox.Pressed.Editable.Button.Background" EndPoint="0,1" StartPoint="0,0">
  143. <GradientStop Color="#FFDAEBFC" Offset="0.0"/>
  144. <GradientStop Color="#FFC4E0FC" Offset="1.0"/>
  145. </LinearGradientBrush>
  146. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Button.Border" Color="#FF569DE5"/>
  147. <SolidColorBrush x:Key="ComboBox.Disabled.Background" Color="#FFF0F0F0"/>
  148. <SolidColorBrush x:Key="ComboBox.Disabled.Border" Color="#FFD9D9D9"/>
  149. <SolidColorBrush x:Key="ComboBox.Disabled.Glyph" Color="#FFBFBFBF"/>
  150. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Background" Color="#FFFFFFFF"/>
  151. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Border" Color="#FFBFBFBF"/>
  152. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Background" Color="Transparent"/>
  153. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Border" Color="Transparent"/>
  154. <Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
  155. <Setter Property="OverridesDefaultStyle" Value="true"/>
  156. <Setter Property="IsTabStop" Value="false"/>
  157. <Setter Property="Focusable" Value="false"/>
  158. <Setter Property="ClickMode" Value="Press"/>
  159. <Setter Property="Template">
  160. <Setter.Value>
  161. <ControlTemplate TargetType="{x:Type ToggleButton}">
  162. <Border x:Name="templateRoot" Background="{StaticResource ComboBox.Static.Background}" BorderBrush="{StaticResource ComboBox.Static.Border}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="true">
  163. <Border x:Name="splitBorder" BorderBrush="Transparent" BorderThickness="1" HorizontalAlignment="Right" Margin="0" SnapsToDevicePixels="true" Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}">
  164. <Path x:Name="arrow" Data="F1 M 0,0 L 2.667,2.66665 L 5.3334,0 L 5.3334,-1.78168 L 2.6667,0.88501 L0,-1.78168 L0,0 Z" Fill="{StaticResource ComboBox.Static.Glyph}" HorizontalAlignment="Center" Margin="0" VerticalAlignment="Center"/>
  165. </Border>
  166. </Border>
  167. <ControlTemplate.Triggers>
  168. <MultiDataTrigger>
  169. <MultiDataTrigger.Conditions>
  170. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  171. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="false"/>
  172. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="false"/>
  173. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="true"/>
  174. </MultiDataTrigger.Conditions>
  175. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Background}"/>
  176. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Static.Editable.Border}"/>
  177. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Background}"/>
  178. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Static.Editable.Button.Border}"/>
  179. </MultiDataTrigger>
  180. <Trigger Property="IsMouseOver" Value="true">
  181. <Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.MouseOver.Glyph}"/>
  182. </Trigger>
  183. <MultiDataTrigger>
  184. <MultiDataTrigger.Conditions>
  185. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
  186. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
  187. </MultiDataTrigger.Conditions>
  188. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Background}"/>
  189. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Border}"/>
  190. </MultiDataTrigger>
  191. <MultiDataTrigger>
  192. <MultiDataTrigger.Conditions>
  193. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true"/>
  194. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  195. </MultiDataTrigger.Conditions>
  196. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Background}"/>
  197. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.MouseOver.Editable.Border}"/>
  198. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Background}"/>
  199. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Border}"/>
  200. </MultiDataTrigger>
  201. <Trigger Property="IsPressed" Value="true">
  202. <Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Pressed.Glyph}"/>
  203. </Trigger>
  204. <MultiDataTrigger>
  205. <MultiDataTrigger.Conditions>
  206. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
  207. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
  208. </MultiDataTrigger.Conditions>
  209. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Background}"/>
  210. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Border}"/>
  211. </MultiDataTrigger>
  212. <MultiDataTrigger>
  213. <MultiDataTrigger.Conditions>
  214. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true"/>
  215. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  216. </MultiDataTrigger.Conditions>
  217. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Background}"/>
  218. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Pressed.Editable.Border}"/>
  219. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Background}"/>
  220. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Pressed.Editable.Button.Border}"/>
  221. </MultiDataTrigger>
  222. <Trigger Property="IsEnabled" Value="false">
  223. <Setter Property="Fill" TargetName="arrow" Value="{StaticResource ComboBox.Disabled.Glyph}"/>
  224. </Trigger>
  225. <MultiDataTrigger>
  226. <MultiDataTrigger.Conditions>
  227. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
  228. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false"/>
  229. </MultiDataTrigger.Conditions>
  230. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Background}"/>
  231. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Border}"/>
  232. </MultiDataTrigger>
  233. <MultiDataTrigger>
  234. <MultiDataTrigger.Conditions>
  235. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false"/>
  236. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true"/>
  237. </MultiDataTrigger.Conditions>
  238. <Setter Property="Background" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Background}"/>
  239. <Setter Property="BorderBrush" TargetName="templateRoot" Value="{StaticResource ComboBox.Disabled.Editable.Border}"/>
  240. <Setter Property="Background" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Background}"/>
  241. <Setter Property="BorderBrush" TargetName="splitBorder" Value="{StaticResource ComboBox.Disabled.Editable.Button.Border}"/>
  242. </MultiDataTrigger>
  243. </ControlTemplate.Triggers>
  244. </ControlTemplate>
  245. </Setter.Value>
  246. </Setter>
  247. </Style>
  248. <ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
  249. <Grid x:Name="templateRoot" SnapsToDevicePixels="true">
  250. <Grid.ColumnDefinitions>
  251. <ColumnDefinition Width="*"/>
  252. <ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
  253. </Grid.ColumnDefinitions>
  254. <Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
  255. <theme:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
  256. <Border x:Name="dropDownBorder" Background="Transparent" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
  257. <ScrollViewer x:Name="DropDownScrollViewer">
  258. <Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
  259. <Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
  260. <Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
  261. </Canvas>
  262. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  263. </Grid>
  264. </ScrollViewer>
  265. </Border>
  266. </theme:SystemDropShadowChrome>
  267. </Popup>
  268. <ToggleButton x:Name="toggleButton" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/>
  269. <Border x:Name="border" Background="{StaticResource TextBox.Static.Background}" Margin="{TemplateBinding BorderThickness}">
  270. <TextBox x:Name="PART_EditableTextBox" HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}" IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}" Margin="{TemplateBinding Padding}" Style="{StaticResource ComboBoxEditableTextBox}" VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"/>
  271. </Border>
  272. </Grid>
  273. <ControlTemplate.Triggers>
  274. <Trigger Property="IsEnabled" Value="false">
  275. <Setter Property="Opacity" TargetName="border" Value="0.56"/>
  276. </Trigger>
  277. <Trigger Property="IsKeyboardFocusWithin" Value="true">
  278. <Setter Property="Foreground" Value="Black"/>
  279. </Trigger>
  280. <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
  281. <Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
  282. <Setter Property="Color" TargetName="shadow" Value="#71000000"/>
  283. </Trigger>
  284. <Trigger Property="HasItems" Value="false">
  285. <Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
  286. </Trigger>
  287. <MultiTrigger>
  288. <MultiTrigger.Conditions>
  289. <Condition Property="IsGrouping" Value="true"/>
  290. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
  291. </MultiTrigger.Conditions>
  292. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  293. </MultiTrigger>
  294. <Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
  295. <Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
  296. <Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
  297. </Trigger>
  298. </ControlTemplate.Triggers>
  299. </ControlTemplate>
  300. <ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}">
  301. <Grid x:Name="templateRoot" SnapsToDevicePixels="true">
  302. <Grid.ColumnDefinitions>
  303. <ColumnDefinition Width="*"/>
  304. <ColumnDefinition MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" Width="0"/>
  305. </Grid.ColumnDefinitions>
  306. <Popup x:Name="PART_Popup" AllowsTransparency="true" Grid.ColumnSpan="2" IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Margin="1" Placement="Bottom" PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
  307. <theme:SystemDropShadowChrome x:Name="shadow" Color="Transparent" MinWidth="{Binding ActualWidth, ElementName=templateRoot}" MaxHeight="{TemplateBinding MaxDropDownHeight}">
  308. <Border x:Name="dropDownBorder" Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}" BorderThickness="1">
  309. <ScrollViewer x:Name="DropDownScrollViewer">
  310. <Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
  311. <Canvas x:Name="canvas" HorizontalAlignment="Left" Height="0" VerticalAlignment="Top" Width="0">
  312. <Rectangle x:Name="opaqueRect" Fill="{Binding Background, ElementName=dropDownBorder}" Height="{Binding ActualHeight, ElementName=dropDownBorder}" Width="{Binding ActualWidth, ElementName=dropDownBorder}"/>
  313. </Canvas>
  314. <ItemsPresenter x:Name="ItemsPresenter" KeyboardNavigation.DirectionalNavigation="Contained" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
  315. </Grid>
  316. </ScrollViewer>
  317. </Border>
  318. </theme:SystemDropShadowChrome>
  319. </Popup>
  320. <ToggleButton x:Name="toggleButton" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Grid.ColumnSpan="2" IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}" Style="{StaticResource ComboBoxToggleButton}"/>
  321. <ContentPresenter x:Name="contentPresenter" ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}" ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}" Content="{TemplateBinding SelectionBoxItem}" ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" IsHitTestVisible="false" Margin="{TemplateBinding Padding}" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
  322. </Grid>
  323. <ControlTemplate.Triggers>
  324. <Trigger Property="HasDropShadow" SourceName="PART_Popup" Value="true">
  325. <Setter Property="Margin" TargetName="shadow" Value="0,0,5,5"/>
  326. <Setter Property="Color" TargetName="shadow" Value="#71000000"/>
  327. </Trigger>
  328. <Trigger Property="HasItems" Value="false">
  329. <Setter Property="Height" TargetName="dropDownBorder" Value="95"/>
  330. </Trigger>
  331. <MultiTrigger>
  332. <MultiTrigger.Conditions>
  333. <Condition Property="IsGrouping" Value="true"/>
  334. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false"/>
  335. </MultiTrigger.Conditions>
  336. <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>
  337. </MultiTrigger>
  338. <Trigger Property="ScrollViewer.CanContentScroll" SourceName="DropDownScrollViewer" Value="false">
  339. <Setter Property="Canvas.Top" TargetName="opaqueRect" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}"/>
  340. <Setter Property="Canvas.Left" TargetName="opaqueRect" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}"/>
  341. </Trigger>
  342. </ControlTemplate.Triggers>
  343. </ControlTemplate>
  344. <Style x:Key="ComboBoxStyle1" TargetType="{x:Type ComboBox}">
  345. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}"/>
  346. <Setter Property="Background" Value="{StaticResource ComboBox.Static.Background}"/>
  347. <Setter Property="BorderBrush" Value="{StaticResource ComboBox.Static.Border}"/>
  348. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}"/>
  349. <Setter Property="BorderThickness" Value="1"/>
  350. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
  351. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
  352. <Setter Property="Padding" Value="6,3,5,3"/>
  353. <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
  354. <Setter Property="ScrollViewer.PanningMode" Value="Both"/>
  355. <Setter Property="Stylus.IsFlicksEnabled" Value="False"/>
  356. <Setter Property="Template" Value="{StaticResource ComboBoxTemplate}"/>
  357. <Style.Triggers>
  358. <Trigger Property="IsEditable" Value="true">
  359. <Setter Property="IsTabStop" Value="false"/>
  360. <Setter Property="Padding" Value="2"/>
  361. <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}"/>
  362. </Trigger>
  363. </Style.Triggers>
  364. </Style>
  365. </UserControl.Resources>
  366. <Grid>
  367. <Grid.RowDefinitions>
  368. <RowDefinition Height="0.12*"/>
  369. <RowDefinition/>
  370. </Grid.RowDefinitions>
  371. <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
  372. <ComboBox ItemsSource="{Binding DeviceName}" Text="滚筒输送线" Style="{StaticResource ComboBoxStyle1}" SelectionChanged="ComboBox_SelectionChanged" FontSize="20" Foreground="#FF2AB2E7" Width="120" Height="40" Margin="0,0,10,0"></ComboBox>
  373. <Button HorizontalAlignment="Right" Width="120" Height="40" Margin="0,0,10,0" Background="Transparent" Content="保存配置" Foreground="#FF2AB2E7" FontSize="20" BorderBrush="LightSkyBlue" BorderThickness="2" Command="{Binding SaveDataCommand}"></Button>
  374. </StackPanel>
  375. <!--变量配置-->
  376. <DataGrid Name="GT" Grid.Row="1" ItemsSource="{Binding Variables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False"
  377. AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}"
  378. LoadingRow="DataGrid_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
  379. <DataGrid.Columns>
  380. <DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
  381. <DataGridTemplateColumn.CellTemplate>
  382. <DataTemplate>
  383. <TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
  384. </DataTemplate>
  385. </DataGridTemplateColumn.CellTemplate>
  386. </DataGridTemplateColumn>
  387. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }">
  388. </DataGridTextColumn>
  389. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }">
  390. </DataGridTextColumn>
  391. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  392. <DataGridTemplateColumn.CellTemplate>
  393. <DataTemplate>
  394. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  395. </DataTemplate>
  396. </DataGridTemplateColumn.CellTemplate>
  397. </DataGridTemplateColumn>-->
  398. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  399. <DataGridTemplateColumn.CellTemplate>
  400. <DataTemplate>
  401. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  402. </DataTemplate>
  403. </DataGridTemplateColumn.CellTemplate>
  404. </DataGridTemplateColumn>-->
  405. </DataGrid.Columns>
  406. </DataGrid>
  407. <!--炒锅1配置-->
  408. <DataGrid x:Name="fryOne" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryOneVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False"
  409. AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}"
  410. LoadingRow="fryOne_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
  411. <DataGrid.Columns>
  412. <DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
  413. <DataGridTemplateColumn.CellTemplate>
  414. <DataTemplate>
  415. <TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
  416. </DataTemplate>
  417. </DataGridTemplateColumn.CellTemplate>
  418. </DataGridTemplateColumn>
  419. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }">
  420. </DataGridTextColumn>
  421. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }">
  422. </DataGridTextColumn>
  423. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  424. <DataGridTemplateColumn.CellTemplate>
  425. <DataTemplate>
  426. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  427. </DataTemplate>
  428. </DataGridTemplateColumn.CellTemplate>
  429. </DataGridTemplateColumn>-->
  430. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  431. <DataGridTemplateColumn.CellTemplate>
  432. <DataTemplate>
  433. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  434. </DataTemplate>
  435. </DataGridTemplateColumn.CellTemplate>
  436. </DataGridTemplateColumn>-->
  437. </DataGrid.Columns>
  438. </DataGrid>
  439. <!--炒锅2配置-->
  440. <DataGrid x:Name="fryTwo" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryTwoVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False"
  441. AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}"
  442. LoadingRow="fryTwo_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
  443. <DataGrid.Columns>
  444. <DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
  445. <DataGridTemplateColumn.CellTemplate>
  446. <DataTemplate>
  447. <TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
  448. </DataTemplate>
  449. </DataGridTemplateColumn.CellTemplate>
  450. </DataGridTemplateColumn>
  451. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }">
  452. </DataGridTextColumn>
  453. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }">
  454. </DataGridTextColumn>
  455. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  456. <DataGridTemplateColumn.CellTemplate>
  457. <DataTemplate>
  458. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  459. </DataTemplate>
  460. </DataGridTemplateColumn.CellTemplate>
  461. </DataGridTemplateColumn>-->
  462. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  463. <DataGridTemplateColumn.CellTemplate>
  464. <DataTemplate>
  465. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  466. </DataTemplate>
  467. </DataGridTemplateColumn.CellTemplate>
  468. </DataGridTemplateColumn>-->
  469. </DataGrid.Columns>
  470. </DataGrid>
  471. <!--炒锅3配置-->
  472. <DataGrid x:Name="fryThree" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryThreeVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False"
  473. AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}"
  474. LoadingRow="fryThree_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
  475. <DataGrid.Columns>
  476. <DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
  477. <DataGridTemplateColumn.CellTemplate>
  478. <DataTemplate>
  479. <TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
  480. </DataTemplate>
  481. </DataGridTemplateColumn.CellTemplate>
  482. </DataGridTemplateColumn>
  483. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }">
  484. </DataGridTextColumn>
  485. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }">
  486. </DataGridTextColumn>
  487. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  488. <DataGridTemplateColumn.CellTemplate>
  489. <DataTemplate>
  490. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  491. </DataTemplate>
  492. </DataGridTemplateColumn.CellTemplate>
  493. </DataGridTemplateColumn>-->
  494. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  495. <DataGridTemplateColumn.CellTemplate>
  496. <DataTemplate>
  497. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  498. </DataTemplate>
  499. </DataGridTemplateColumn.CellTemplate>
  500. </DataGridTemplateColumn>-->
  501. </DataGrid.Columns>
  502. </DataGrid>
  503. <!--炒锅4配置-->
  504. <DataGrid x:Name="fryFour" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryFourVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False"
  505. AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}"
  506. LoadingRow="fryFour_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
  507. <DataGrid.Columns>
  508. <DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
  509. <DataGridTemplateColumn.CellTemplate>
  510. <DataTemplate>
  511. <TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
  512. </DataTemplate>
  513. </DataGridTemplateColumn.CellTemplate>
  514. </DataGridTemplateColumn>
  515. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }">
  516. </DataGridTextColumn>
  517. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }">
  518. </DataGridTextColumn>
  519. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  520. <DataGridTemplateColumn.CellTemplate>
  521. <DataTemplate>
  522. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  523. </DataTemplate>
  524. </DataGridTemplateColumn.CellTemplate>
  525. </DataGridTemplateColumn>-->
  526. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  527. <DataGridTemplateColumn.CellTemplate>
  528. <DataTemplate>
  529. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  530. </DataTemplate>
  531. </DataGridTemplateColumn.CellTemplate>
  532. </DataGridTemplateColumn>-->
  533. </DataGrid.Columns>
  534. </DataGrid>
  535. <!--炒锅5配置-->
  536. <DataGrid x:Name="fryFive" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryFiveVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False"
  537. AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}"
  538. LoadingRow="fryFive_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
  539. <DataGrid.Columns>
  540. <DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
  541. <DataGridTemplateColumn.CellTemplate>
  542. <DataTemplate>
  543. <TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
  544. </DataTemplate>
  545. </DataGridTemplateColumn.CellTemplate>
  546. </DataGridTemplateColumn>
  547. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }">
  548. </DataGridTextColumn>
  549. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }">
  550. </DataGridTextColumn>
  551. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  552. <DataGridTemplateColumn.CellTemplate>
  553. <DataTemplate>
  554. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  555. </DataTemplate>
  556. </DataGridTemplateColumn.CellTemplate>
  557. </DataGridTemplateColumn>-->
  558. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  559. <DataGridTemplateColumn.CellTemplate>
  560. <DataTemplate>
  561. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  562. </DataTemplate>
  563. </DataGridTemplateColumn.CellTemplate>
  564. </DataGridTemplateColumn>-->
  565. </DataGrid.Columns>
  566. </DataGrid>
  567. </Grid>
  568. </UserControl>