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

864 lines
50 KiB

  1. <UserControl
  2. x:Class="BPASmartClient.CustomResource.Pages.View.VariableConfigView"
  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:BPASmartClient.CustomResource.Pages.View"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero2"
  9. xmlns:vm="clr-namespace:BPASmartClient.CustomResource.Pages.ViewModel"
  10. d:DesignHeight="450"
  11. d:DesignWidth="800"
  12. mc:Ignorable="d">
  13. <UserControl.DataContext>
  14. <vm:VariableViewModel />
  15. </UserControl.DataContext>
  16. <UserControl.Resources>
  17. <Style x:Key="dataGrid" TargetType="DataGrid">
  18. <Setter Property="HorizontalGridLinesBrush" Value="#FF2AB2E7" />
  19. <Setter Property="VerticalGridLinesBrush" Value="#FF2AB2E7" />
  20. <Setter Property="BorderThickness" Value="1" />
  21. <Setter Property="BorderBrush" Value="#FF2AB2E7" />
  22. <Setter Property="CanUserResizeColumns" Value="False" />
  23. <Setter Property="HeadersVisibility" Value="Column" />
  24. <Setter Property="HorizontalScrollBarVisibility" Value="Hidden" />
  25. <Setter Property="VerticalScrollBarVisibility" Value="Hidden" />
  26. </Style>
  27. <Style x:Key="ColumHeaderStyle" TargetType="DataGridColumnHeader">
  28. <Setter Property="HorizontalContentAlignment" Value="Center" />
  29. <Setter Property="VerticalAlignment" Value="Center" />
  30. <Setter Property="Background" Value="#FF2AB2E7" />
  31. <Setter Property="Foreground" Value="White" />
  32. <Setter Property="BorderThickness" Value="1" />
  33. <Setter Property="BorderBrush" Value="white" />
  34. <Setter Property="Height" Value="30" />
  35. <Setter Property="FontSize" Value="16" />
  36. <Setter Property="FontWeight" Value="Heavy" />
  37. <Setter Property="Margin" Value="-1,-1,-1,-1" />
  38. </Style>
  39. <Style x:Key="rowStyle" TargetType="DataGridRow">
  40. <Setter Property="Height" Value="35" />
  41. <Setter Property="Foreground" Value="#FF2AB2E7" />
  42. <Style.Triggers>
  43. <Trigger Property="AlternationIndex" Value="0">
  44. <Setter Property="Background" Value="Transparent" />
  45. </Trigger>
  46. <Trigger Property="AlternationIndex" Value="1">
  47. <Setter Property="Background" Value="Transparent" />
  48. </Trigger>
  49. <Trigger Property="IsMouseOver" Value="True">
  50. <Setter Property="Background" Value="#000066" />
  51. </Trigger>
  52. </Style.Triggers>
  53. </Style>
  54. <Style x:Key="textboxStyle" TargetType="TextBox">
  55. <Setter Property="Background" Value="Transparent" />
  56. <Setter Property="Foreground" Value="SkyBlue" />
  57. <Setter Property="HorizontalContentAlignment" Value="Center" />
  58. <Setter Property="VerticalContentAlignment" Value="Center" />
  59. <Setter Property="FontSize" Value="16" />
  60. <Setter Property="BorderThickness" Value="0" />
  61. <Setter Property="CaretBrush" Value="LightBlue" />
  62. <Style.Triggers>
  63. <Trigger Property="IsFocused" Value="True">
  64. <Setter Property="Cursor" Value="Arrow" />
  65. </Trigger>
  66. </Style.Triggers>
  67. </Style>
  68. <Style x:Key="cellStyle" TargetType="DataGridCell">
  69. <Style.Triggers>
  70. <Trigger Property="IsSelected" Value="True">
  71. <Setter Property="Background" Value="Transparent" />
  72. <Setter Property="Foreground" Value="SkyBlue" />
  73. </Trigger>
  74. <Trigger Property="IsSelected" Value="false">
  75. <Setter Property="Background" Value="Transparent" />
  76. <Setter Property="Foreground" Value="SkyBlue" />
  77. </Trigger>
  78. </Style.Triggers>
  79. </Style>
  80. <Style x:Key="dgCellstyle" TargetType="TextBlock">
  81. <Setter Property="HorizontalAlignment" Value="Center" />
  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
  90. Margin="2"
  91. SnapsToDevicePixels="true"
  92. Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"
  93. StrokeDashArray="1 2"
  94. StrokeThickness="1" />
  95. </ControlTemplate>
  96. </Setter.Value>
  97. </Setter>
  98. </Style>
  99. <SolidColorBrush x:Key="TextBox.Static.Background" Color="#FFFFFFFF" />
  100. <Style x:Key="ComboBoxEditableTextBox" TargetType="{x:Type TextBox}">
  101. <Setter Property="OverridesDefaultStyle" Value="true" />
  102. <Setter Property="AllowDrop" Value="true" />
  103. <Setter Property="MinWidth" Value="0" />
  104. <Setter Property="MinHeight" Value="0" />
  105. <Setter Property="FocusVisualStyle" Value="{x:Null}" />
  106. <Setter Property="ScrollViewer.PanningMode" Value="VerticalFirst" />
  107. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  108. <Setter Property="Template">
  109. <Setter.Value>
  110. <ControlTemplate TargetType="{x:Type TextBox}">
  111. <ScrollViewer
  112. x:Name="PART_ContentHost"
  113. Background="Transparent"
  114. Focusable="false"
  115. HorizontalScrollBarVisibility="Hidden"
  116. VerticalScrollBarVisibility="Hidden" />
  117. </ControlTemplate>
  118. </Setter.Value>
  119. </Setter>
  120. </Style>
  121. <LinearGradientBrush x:Key="ComboBox.Static.Background" StartPoint="0,0" EndPoint="0,1">
  122. <GradientStop Offset="0.0" Color="Transparent" />
  123. <GradientStop Offset="1.0" Color="Transparent" />
  124. </LinearGradientBrush>
  125. <SolidColorBrush x:Key="ComboBox.Static.Border" Color="#FFACACAC" />
  126. <SolidColorBrush x:Key="ComboBox.Static.Glyph" Color="#FF2AB2E7" />
  127. <SolidColorBrush x:Key="ComboBox.Static.Editable.Background" Color="Transparent" />
  128. <SolidColorBrush x:Key="ComboBox.Static.Editable.Border" Color="#FFABADB3" />
  129. <SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Background" Color="Transparent" />
  130. <SolidColorBrush x:Key="ComboBox.Static.Editable.Button.Border" Color="Transparent" />
  131. <LinearGradientBrush x:Key="ComboBox.MouseOver.Background" StartPoint="0,0" EndPoint="0,1">
  132. <GradientStop Offset="0.0" Color="Transparent" />
  133. <GradientStop Offset="1.0" Color="Transparent" />
  134. </LinearGradientBrush>
  135. <SolidColorBrush x:Key="ComboBox.MouseOver.Border" Color="#FF7EB4EA" />
  136. <SolidColorBrush x:Key="ComboBox.MouseOver.Glyph" Color="#FF000000" />
  137. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Background" Color="Transparent" />
  138. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Border" Color="#FF7EB4EA" />
  139. <LinearGradientBrush x:Key="ComboBox.MouseOver.Editable.Button.Background" StartPoint="0,0" EndPoint="0,1">
  140. <GradientStop Offset="0.0" Color="Transparent" />
  141. <GradientStop Offset="1.0" Color="Transparent" />
  142. </LinearGradientBrush>
  143. <SolidColorBrush x:Key="ComboBox.MouseOver.Editable.Button.Border" Color="#FF7EB4EA" />
  144. <LinearGradientBrush x:Key="ComboBox.Pressed.Background" StartPoint="0,0" EndPoint="0,1">
  145. <GradientStop Offset="0.0" Color="#FFDAECFC" />
  146. <GradientStop Offset="1.0" Color="#FFC4E0FC" />
  147. </LinearGradientBrush>
  148. <SolidColorBrush x:Key="ComboBox.Pressed.Border" Color="#FF569DE5" />
  149. <SolidColorBrush x:Key="ComboBox.Pressed.Glyph" Color="#FF000000" />
  150. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Background" Color="#FFFFFFFF" />
  151. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Border" Color="#FF569DE5" />
  152. <LinearGradientBrush x:Key="ComboBox.Pressed.Editable.Button.Background" StartPoint="0,0" EndPoint="0,1">
  153. <GradientStop Offset="0.0" Color="#FFDAEBFC" />
  154. <GradientStop Offset="1.0" Color="#FFC4E0FC" />
  155. </LinearGradientBrush>
  156. <SolidColorBrush x:Key="ComboBox.Pressed.Editable.Button.Border" Color="#FF569DE5" />
  157. <SolidColorBrush x:Key="ComboBox.Disabled.Background" Color="#FFF0F0F0" />
  158. <SolidColorBrush x:Key="ComboBox.Disabled.Border" Color="#FFD9D9D9" />
  159. <SolidColorBrush x:Key="ComboBox.Disabled.Glyph" Color="#FFBFBFBF" />
  160. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Background" Color="#FFFFFFFF" />
  161. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Border" Color="#FFBFBFBF" />
  162. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Background" Color="Transparent" />
  163. <SolidColorBrush x:Key="ComboBox.Disabled.Editable.Button.Border" Color="Transparent" />
  164. <Style x:Key="ComboBoxToggleButton" TargetType="{x:Type ToggleButton}">
  165. <Setter Property="OverridesDefaultStyle" Value="true" />
  166. <Setter Property="IsTabStop" Value="false" />
  167. <Setter Property="Focusable" Value="false" />
  168. <Setter Property="ClickMode" Value="Press" />
  169. <Setter Property="Template">
  170. <Setter.Value>
  171. <ControlTemplate TargetType="{x:Type ToggleButton}">
  172. <Border
  173. x:Name="templateRoot"
  174. Background="{StaticResource ComboBox.Static.Background}"
  175. BorderBrush="{StaticResource ComboBox.Static.Border}"
  176. BorderThickness="{TemplateBinding BorderThickness}"
  177. SnapsToDevicePixels="true">
  178. <Border
  179. x:Name="splitBorder"
  180. Width="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}"
  181. Margin="0"
  182. HorizontalAlignment="Right"
  183. BorderBrush="Transparent"
  184. BorderThickness="1"
  185. SnapsToDevicePixels="true">
  186. <Path
  187. x:Name="arrow"
  188. Margin="0"
  189. HorizontalAlignment="Center"
  190. VerticalAlignment="Center"
  191. 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"
  192. Fill="{StaticResource ComboBox.Static.Glyph}" />
  193. </Border>
  194. </Border>
  195. <ControlTemplate.Triggers>
  196. <MultiDataTrigger>
  197. <MultiDataTrigger.Conditions>
  198. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true" />
  199. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="false" />
  200. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="false" />
  201. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="true" />
  202. </MultiDataTrigger.Conditions>
  203. <Setter TargetName="templateRoot" Property="Background" Value="{StaticResource ComboBox.Static.Editable.Background}" />
  204. <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource ComboBox.Static.Editable.Border}" />
  205. <Setter TargetName="splitBorder" Property="Background" Value="{StaticResource ComboBox.Static.Editable.Button.Background}" />
  206. <Setter TargetName="splitBorder" Property="BorderBrush" Value="{StaticResource ComboBox.Static.Editable.Button.Border}" />
  207. </MultiDataTrigger>
  208. <Trigger Property="IsMouseOver" Value="true">
  209. <Setter TargetName="arrow" Property="Fill" Value="{StaticResource ComboBox.MouseOver.Glyph}" />
  210. </Trigger>
  211. <MultiDataTrigger>
  212. <MultiDataTrigger.Conditions>
  213. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
  214. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false" />
  215. </MultiDataTrigger.Conditions>
  216. <Setter TargetName="templateRoot" Property="Background" Value="{StaticResource ComboBox.MouseOver.Background}" />
  217. <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource ComboBox.MouseOver.Border}" />
  218. </MultiDataTrigger>
  219. <MultiDataTrigger>
  220. <MultiDataTrigger.Conditions>
  221. <Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="true" />
  222. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true" />
  223. </MultiDataTrigger.Conditions>
  224. <Setter TargetName="templateRoot" Property="Background" Value="{StaticResource ComboBox.MouseOver.Editable.Background}" />
  225. <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource ComboBox.MouseOver.Editable.Border}" />
  226. <Setter TargetName="splitBorder" Property="Background" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Background}" />
  227. <Setter TargetName="splitBorder" Property="BorderBrush" Value="{StaticResource ComboBox.MouseOver.Editable.Button.Border}" />
  228. </MultiDataTrigger>
  229. <Trigger Property="IsPressed" Value="true">
  230. <Setter TargetName="arrow" Property="Fill" Value="{StaticResource ComboBox.Pressed.Glyph}" />
  231. </Trigger>
  232. <MultiDataTrigger>
  233. <MultiDataTrigger.Conditions>
  234. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true" />
  235. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false" />
  236. </MultiDataTrigger.Conditions>
  237. <Setter TargetName="templateRoot" Property="Background" Value="{StaticResource ComboBox.Pressed.Background}" />
  238. <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource ComboBox.Pressed.Border}" />
  239. </MultiDataTrigger>
  240. <MultiDataTrigger>
  241. <MultiDataTrigger.Conditions>
  242. <Condition Binding="{Binding IsPressed, RelativeSource={RelativeSource Self}}" Value="true" />
  243. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true" />
  244. </MultiDataTrigger.Conditions>
  245. <Setter TargetName="templateRoot" Property="Background" Value="{StaticResource ComboBox.Pressed.Editable.Background}" />
  246. <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource ComboBox.Pressed.Editable.Border}" />
  247. <Setter TargetName="splitBorder" Property="Background" Value="{StaticResource ComboBox.Pressed.Editable.Button.Background}" />
  248. <Setter TargetName="splitBorder" Property="BorderBrush" Value="{StaticResource ComboBox.Pressed.Editable.Button.Border}" />
  249. </MultiDataTrigger>
  250. <Trigger Property="IsEnabled" Value="false">
  251. <Setter TargetName="arrow" Property="Fill" Value="{StaticResource ComboBox.Disabled.Glyph}" />
  252. </Trigger>
  253. <MultiDataTrigger>
  254. <MultiDataTrigger.Conditions>
  255. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
  256. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="false" />
  257. </MultiDataTrigger.Conditions>
  258. <Setter TargetName="templateRoot" Property="Background" Value="{StaticResource ComboBox.Disabled.Background}" />
  259. <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource ComboBox.Disabled.Border}" />
  260. </MultiDataTrigger>
  261. <MultiDataTrigger>
  262. <MultiDataTrigger.Conditions>
  263. <Condition Binding="{Binding IsEnabled, RelativeSource={RelativeSource Self}}" Value="false" />
  264. <Condition Binding="{Binding IsEditable, RelativeSource={RelativeSource AncestorType={x:Type ComboBox}}}" Value="true" />
  265. </MultiDataTrigger.Conditions>
  266. <Setter TargetName="templateRoot" Property="Background" Value="{StaticResource ComboBox.Disabled.Editable.Background}" />
  267. <Setter TargetName="templateRoot" Property="BorderBrush" Value="{StaticResource ComboBox.Disabled.Editable.Border}" />
  268. <Setter TargetName="splitBorder" Property="Background" Value="{StaticResource ComboBox.Disabled.Editable.Button.Background}" />
  269. <Setter TargetName="splitBorder" Property="BorderBrush" Value="{StaticResource ComboBox.Disabled.Editable.Button.Border}" />
  270. </MultiDataTrigger>
  271. </ControlTemplate.Triggers>
  272. </ControlTemplate>
  273. </Setter.Value>
  274. </Setter>
  275. </Style>
  276. <ControlTemplate x:Key="ComboBoxEditableTemplate" TargetType="{x:Type ComboBox}">
  277. <Grid x:Name="templateRoot" SnapsToDevicePixels="true">
  278. <Grid.ColumnDefinitions>
  279. <ColumnDefinition Width="*" />
  280. <ColumnDefinition Width="0" MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
  281. </Grid.ColumnDefinitions>
  282. <Popup
  283. x:Name="PART_Popup"
  284. Grid.ColumnSpan="2"
  285. AllowsTransparency="true"
  286. IsOpen="{Binding IsDropDownOpen, RelativeSource={RelativeSource TemplatedParent}}"
  287. Placement="Bottom"
  288. PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
  289. <theme:SystemDropShadowChrome
  290. x:Name="shadow"
  291. MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
  292. MaxHeight="{TemplateBinding MaxDropDownHeight}"
  293. Color="Transparent">
  294. <Border
  295. x:Name="dropDownBorder"
  296. Background="Transparent"
  297. BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}"
  298. BorderThickness="1">
  299. <ScrollViewer x:Name="DropDownScrollViewer">
  300. <Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
  301. <Canvas
  302. x:Name="canvas"
  303. Width="0"
  304. Height="0"
  305. HorizontalAlignment="Left"
  306. VerticalAlignment="Top">
  307. <Rectangle
  308. x:Name="opaqueRect"
  309. Width="{Binding ActualWidth, ElementName=dropDownBorder}"
  310. Height="{Binding ActualHeight, ElementName=dropDownBorder}"
  311. Fill="{Binding Background, ElementName=dropDownBorder}" />
  312. </Canvas>
  313. <ItemsPresenter
  314. x:Name="ItemsPresenter"
  315. KeyboardNavigation.DirectionalNavigation="Contained"
  316. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  317. </Grid>
  318. </ScrollViewer>
  319. </Border>
  320. </theme:SystemDropShadowChrome>
  321. </Popup>
  322. <ToggleButton
  323. x:Name="toggleButton"
  324. Grid.ColumnSpan="2"
  325. Background="{TemplateBinding Background}"
  326. BorderBrush="{TemplateBinding BorderBrush}"
  327. BorderThickness="{TemplateBinding BorderThickness}"
  328. IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  329. Style="{StaticResource ComboBoxToggleButton}" />
  330. <Border
  331. x:Name="border"
  332. Margin="{TemplateBinding BorderThickness}"
  333. Background="{StaticResource TextBox.Static.Background}">
  334. <TextBox
  335. x:Name="PART_EditableTextBox"
  336. Margin="{TemplateBinding Padding}"
  337. HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
  338. VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
  339. IsReadOnly="{Binding IsReadOnly, RelativeSource={RelativeSource TemplatedParent}}"
  340. Style="{StaticResource ComboBoxEditableTextBox}" />
  341. </Border>
  342. </Grid>
  343. <ControlTemplate.Triggers>
  344. <Trigger Property="IsEnabled" Value="false">
  345. <Setter TargetName="border" Property="Opacity" Value="0.56" />
  346. </Trigger>
  347. <Trigger Property="IsKeyboardFocusWithin" Value="true">
  348. <Setter Property="Foreground" Value="Black" />
  349. </Trigger>
  350. <Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true">
  351. <Setter TargetName="shadow" Property="Margin" Value="0,0,5,5" />
  352. <Setter TargetName="shadow" Property="Color" Value="#71000000" />
  353. </Trigger>
  354. <Trigger Property="HasItems" Value="false">
  355. <Setter TargetName="dropDownBorder" Property="Height" Value="95" />
  356. </Trigger>
  357. <MultiTrigger>
  358. <MultiTrigger.Conditions>
  359. <Condition Property="IsGrouping" Value="true" />
  360. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
  361. </MultiTrigger.Conditions>
  362. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  363. </MultiTrigger>
  364. <Trigger SourceName="DropDownScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false">
  365. <Setter TargetName="opaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}" />
  366. <Setter TargetName="opaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}" />
  367. </Trigger>
  368. </ControlTemplate.Triggers>
  369. </ControlTemplate>
  370. <ControlTemplate x:Key="ComboBoxTemplate" TargetType="{x:Type ComboBox}">
  371. <Grid x:Name="templateRoot" SnapsToDevicePixels="true">
  372. <Grid.ColumnDefinitions>
  373. <ColumnDefinition Width="*" />
  374. <ColumnDefinition Width="0" MinWidth="{DynamicResource {x:Static SystemParameters.VerticalScrollBarWidthKey}}" />
  375. </Grid.ColumnDefinitions>
  376. <Popup
  377. x:Name="PART_Popup"
  378. Grid.ColumnSpan="2"
  379. Margin="1"
  380. AllowsTransparency="true"
  381. IsOpen="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  382. Placement="Bottom"
  383. PopupAnimation="{DynamicResource {x:Static SystemParameters.ComboBoxPopupAnimationKey}}">
  384. <theme:SystemDropShadowChrome
  385. x:Name="shadow"
  386. MinWidth="{Binding ActualWidth, ElementName=templateRoot}"
  387. MaxHeight="{TemplateBinding MaxDropDownHeight}"
  388. Color="Transparent">
  389. <Border
  390. x:Name="dropDownBorder"
  391. Background="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"
  392. BorderBrush="{DynamicResource {x:Static SystemColors.WindowFrameBrushKey}}"
  393. BorderThickness="1">
  394. <ScrollViewer x:Name="DropDownScrollViewer">
  395. <Grid x:Name="grid" RenderOptions.ClearTypeHint="Enabled">
  396. <Canvas
  397. x:Name="canvas"
  398. Width="0"
  399. Height="0"
  400. HorizontalAlignment="Left"
  401. VerticalAlignment="Top">
  402. <Rectangle
  403. x:Name="opaqueRect"
  404. Width="{Binding ActualWidth, ElementName=dropDownBorder}"
  405. Height="{Binding ActualHeight, ElementName=dropDownBorder}"
  406. Fill="{Binding Background, ElementName=dropDownBorder}" />
  407. </Canvas>
  408. <ItemsPresenter
  409. x:Name="ItemsPresenter"
  410. KeyboardNavigation.DirectionalNavigation="Contained"
  411. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  412. </Grid>
  413. </ScrollViewer>
  414. </Border>
  415. </theme:SystemDropShadowChrome>
  416. </Popup>
  417. <ToggleButton
  418. x:Name="toggleButton"
  419. Grid.ColumnSpan="2"
  420. Background="{TemplateBinding Background}"
  421. BorderBrush="{TemplateBinding BorderBrush}"
  422. BorderThickness="{TemplateBinding BorderThickness}"
  423. IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
  424. Style="{StaticResource ComboBoxToggleButton}" />
  425. <ContentPresenter
  426. x:Name="contentPresenter"
  427. Margin="{TemplateBinding Padding}"
  428. HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  429. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  430. Content="{TemplateBinding SelectionBoxItem}"
  431. ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
  432. ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
  433. ContentTemplateSelector="{TemplateBinding ItemTemplateSelector}"
  434. IsHitTestVisible="false"
  435. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  436. </Grid>
  437. <ControlTemplate.Triggers>
  438. <Trigger SourceName="PART_Popup" Property="HasDropShadow" Value="true">
  439. <Setter TargetName="shadow" Property="Margin" Value="0,0,5,5" />
  440. <Setter TargetName="shadow" Property="Color" Value="#71000000" />
  441. </Trigger>
  442. <Trigger Property="HasItems" Value="false">
  443. <Setter TargetName="dropDownBorder" Property="Height" Value="95" />
  444. </Trigger>
  445. <MultiTrigger>
  446. <MultiTrigger.Conditions>
  447. <Condition Property="IsGrouping" Value="true" />
  448. <Condition Property="VirtualizingPanel.IsVirtualizingWhenGrouping" Value="false" />
  449. </MultiTrigger.Conditions>
  450. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  451. </MultiTrigger>
  452. <Trigger SourceName="DropDownScrollViewer" Property="ScrollViewer.CanContentScroll" Value="false">
  453. <Setter TargetName="opaqueRect" Property="Canvas.Top" Value="{Binding VerticalOffset, ElementName=DropDownScrollViewer}" />
  454. <Setter TargetName="opaqueRect" Property="Canvas.Left" Value="{Binding HorizontalOffset, ElementName=DropDownScrollViewer}" />
  455. </Trigger>
  456. </ControlTemplate.Triggers>
  457. </ControlTemplate>
  458. <Style x:Key="ComboBoxStyle1" TargetType="{x:Type ComboBox}">
  459. <Setter Property="FocusVisualStyle" Value="{StaticResource FocusVisual}" />
  460. <Setter Property="Background" Value="{StaticResource ComboBox.Static.Background}" />
  461. <Setter Property="BorderBrush" Value="{StaticResource ComboBox.Static.Border}" />
  462. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
  463. <Setter Property="BorderThickness" Value="1" />
  464. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
  465. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
  466. <Setter Property="Padding" Value="6,3,5,3" />
  467. <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
  468. <Setter Property="ScrollViewer.PanningMode" Value="Both" />
  469. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  470. <Setter Property="Template" Value="{StaticResource ComboBoxTemplate}" />
  471. <Style.Triggers>
  472. <Trigger Property="IsEditable" Value="true">
  473. <Setter Property="IsTabStop" Value="false" />
  474. <Setter Property="Padding" Value="2" />
  475. <Setter Property="Template" Value="{StaticResource ComboBoxEditableTemplate}" />
  476. </Trigger>
  477. </Style.Triggers>
  478. </Style>
  479. </UserControl.Resources>
  480. <Grid>
  481. <Grid.RowDefinitions>
  482. <RowDefinition Height="0.12*" />
  483. <RowDefinition />
  484. </Grid.RowDefinitions>
  485. <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
  486. <ComboBox
  487. Width="130"
  488. Height="40"
  489. Margin="0,0,10,0"
  490. VerticalContentAlignment="Center"
  491. FontSize="20"
  492. Foreground="#FF2AB2E7"
  493. ItemsSource="{Binding DeviceName}"
  494. SelectedValue="滚筒输送线"
  495. SelectionChanged="ComboBox_SelectionChanged"
  496. Style="{StaticResource ComboBoxStyle1}" />
  497. <Button
  498. Width="120"
  499. Height="40"
  500. Margin="0,0,10,0"
  501. HorizontalAlignment="Right"
  502. Background="Transparent"
  503. BorderBrush="LightSkyBlue"
  504. BorderThickness="1"
  505. Command="{Binding SaveDataCommand}"
  506. Content="保存配置"
  507. FontSize="20"
  508. Foreground="#FF2AB2E7" />
  509. </StackPanel>
  510. <!-- 变量配置 -->
  511. <DataGrid
  512. Name="GT"
  513. Grid.Row="1"
  514. AutoGenerateColumns="False"
  515. Background="Transparent"
  516. CanUserDeleteRows="True"
  517. CellStyle="{StaticResource cellStyle}"
  518. ColumnHeaderStyle="{StaticResource ColumHeaderStyle}"
  519. EnableRowVirtualization="False"
  520. GridLinesVisibility="All"
  521. IsReadOnly="False"
  522. ItemsSource="{Binding Variables}"
  523. LoadingRow="DataGrid_LoadingRow"
  524. RowStyle="{StaticResource rowStyle}"
  525. Style="{StaticResource dataGrid}">
  526. <DataGrid.Columns>
  527. <DataGridTemplateColumn
  528. Width="0.1*"
  529. Header="ID"
  530. IsReadOnly="True">
  531. <DataGridTemplateColumn.CellTemplate>
  532. <DataTemplate>
  533. <TextBox
  534. IsReadOnly="True"
  535. Style="{StaticResource textboxStyle}"
  536. Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridRow}}, Path=Header}" />
  537. </DataTemplate>
  538. </DataGridTemplateColumn.CellTemplate>
  539. </DataGridTemplateColumn>
  540. <DataGridTextColumn
  541. Width="0.45*"
  542. Binding="{Binding PlcAddress}"
  543. ElementStyle="{StaticResource dgCellstyle}"
  544. Header="PLC地址"
  545. IsReadOnly="False" />
  546. <DataGridTextColumn
  547. Width="0.45*"
  548. Binding="{Binding Length}"
  549. ElementStyle="{StaticResource dgCellstyle}"
  550. Header="地址长度"
  551. IsReadOnly="False" />
  552. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  553. <DataGridTemplateColumn.CellTemplate>
  554. <DataTemplate>
  555. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  556. </DataTemplate>
  557. </DataGridTemplateColumn.CellTemplate>
  558. </DataGridTemplateColumn>-->
  559. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  560. <DataGridTemplateColumn.CellTemplate>
  561. <DataTemplate>
  562. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  563. </DataTemplate>
  564. </DataGridTemplateColumn.CellTemplate>
  565. </DataGridTemplateColumn>-->
  566. </DataGrid.Columns>
  567. </DataGrid>
  568. <!-- 炒锅1配置 -->
  569. <DataGrid
  570. x:Name="fryOne"
  571. Grid.Row="1"
  572. AutoGenerateColumns="False"
  573. Background="Transparent"
  574. CellStyle="{StaticResource cellStyle}"
  575. ColumnHeaderStyle="{StaticResource ColumHeaderStyle}"
  576. EnableRowVirtualization="False"
  577. GridLinesVisibility="All"
  578. IsReadOnly="False"
  579. ItemsSource="{Binding FryOneVariables}"
  580. LoadingRow="fryOne_LoadingRow"
  581. RowStyle="{StaticResource rowStyle}"
  582. Style="{StaticResource dataGrid}"
  583. Visibility="Collapsed">
  584. <DataGrid.Columns>
  585. <DataGridTemplateColumn
  586. Width="0.1*"
  587. Header="ID"
  588. IsReadOnly="True">
  589. <DataGridTemplateColumn.CellTemplate>
  590. <DataTemplate>
  591. <TextBox
  592. IsReadOnly="True"
  593. Style="{StaticResource textboxStyle}"
  594. Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridRow}}, Path=Header}" />
  595. </DataTemplate>
  596. </DataGridTemplateColumn.CellTemplate>
  597. </DataGridTemplateColumn>
  598. <DataGridTextColumn
  599. Width="0.45*"
  600. Binding="{Binding PlcAddress}"
  601. ElementStyle="{StaticResource dgCellstyle}"
  602. Header="PLC地址"
  603. IsReadOnly="False" />
  604. <DataGridTextColumn
  605. Width="0.45*"
  606. Binding="{Binding Length}"
  607. ElementStyle="{StaticResource dgCellstyle}"
  608. Header="地址长度"
  609. IsReadOnly="False" />
  610. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  611. <DataGridTemplateColumn.CellTemplate>
  612. <DataTemplate>
  613. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  614. </DataTemplate>
  615. </DataGridTemplateColumn.CellTemplate>
  616. </DataGridTemplateColumn>-->
  617. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  618. <DataGridTemplateColumn.CellTemplate>
  619. <DataTemplate>
  620. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  621. </DataTemplate>
  622. </DataGridTemplateColumn.CellTemplate>
  623. </DataGridTemplateColumn>-->
  624. </DataGrid.Columns>
  625. </DataGrid>
  626. <!-- 炒锅2配置 -->
  627. <DataGrid
  628. x:Name="fryTwo"
  629. Grid.Row="1"
  630. AutoGenerateColumns="False"
  631. Background="Transparent"
  632. CellStyle="{StaticResource cellStyle}"
  633. ColumnHeaderStyle="{StaticResource ColumHeaderStyle}"
  634. EnableRowVirtualization="False"
  635. GridLinesVisibility="All"
  636. IsReadOnly="False"
  637. ItemsSource="{Binding FryTwoVariables}"
  638. LoadingRow="fryTwo_LoadingRow"
  639. RowStyle="{StaticResource rowStyle}"
  640. Style="{StaticResource dataGrid}"
  641. Visibility="Collapsed">
  642. <DataGrid.Columns>
  643. <DataGridTemplateColumn
  644. Width="0.1*"
  645. Header="ID"
  646. IsReadOnly="True">
  647. <DataGridTemplateColumn.CellTemplate>
  648. <DataTemplate>
  649. <TextBox
  650. IsReadOnly="True"
  651. Style="{StaticResource textboxStyle}"
  652. Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridRow}}, Path=Header}" />
  653. </DataTemplate>
  654. </DataGridTemplateColumn.CellTemplate>
  655. </DataGridTemplateColumn>
  656. <DataGridTextColumn
  657. Width="0.45*"
  658. Binding="{Binding PlcAddress}"
  659. ElementStyle="{StaticResource dgCellstyle}"
  660. Header="PLC地址"
  661. IsReadOnly="False" />
  662. <DataGridTextColumn
  663. Width="0.45*"
  664. Binding="{Binding Length}"
  665. ElementStyle="{StaticResource dgCellstyle}"
  666. Header="地址长度"
  667. IsReadOnly="False" />
  668. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  669. <DataGridTemplateColumn.CellTemplate>
  670. <DataTemplate>
  671. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  672. </DataTemplate>
  673. </DataGridTemplateColumn.CellTemplate>
  674. </DataGridTemplateColumn>-->
  675. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  676. <DataGridTemplateColumn.CellTemplate>
  677. <DataTemplate>
  678. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  679. </DataTemplate>
  680. </DataGridTemplateColumn.CellTemplate>
  681. </DataGridTemplateColumn>-->
  682. </DataGrid.Columns>
  683. </DataGrid>
  684. <!-- 炒锅3配置 -->
  685. <DataGrid
  686. x:Name="fryThree"
  687. Grid.Row="1"
  688. AutoGenerateColumns="False"
  689. Background="Transparent"
  690. CellStyle="{StaticResource cellStyle}"
  691. ColumnHeaderStyle="{StaticResource ColumHeaderStyle}"
  692. EnableRowVirtualization="False"
  693. GridLinesVisibility="All"
  694. IsReadOnly="False"
  695. ItemsSource="{Binding FryThreeVariables}"
  696. LoadingRow="fryThree_LoadingRow"
  697. RowStyle="{StaticResource rowStyle}"
  698. Style="{StaticResource dataGrid}"
  699. Visibility="Collapsed">
  700. <DataGrid.Columns>
  701. <DataGridTemplateColumn
  702. Width="0.1*"
  703. Header="ID"
  704. IsReadOnly="True">
  705. <DataGridTemplateColumn.CellTemplate>
  706. <DataTemplate>
  707. <TextBox
  708. IsReadOnly="True"
  709. Style="{StaticResource textboxStyle}"
  710. Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridRow}}, Path=Header}" />
  711. </DataTemplate>
  712. </DataGridTemplateColumn.CellTemplate>
  713. </DataGridTemplateColumn>
  714. <DataGridTextColumn
  715. Width="0.45*"
  716. Binding="{Binding PlcAddress}"
  717. ElementStyle="{StaticResource dgCellstyle}"
  718. Header="PLC地址"
  719. IsReadOnly="False" />
  720. <DataGridTextColumn
  721. Width="0.45*"
  722. Binding="{Binding Length}"
  723. ElementStyle="{StaticResource dgCellstyle}"
  724. Header="地址长度"
  725. IsReadOnly="False" />
  726. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  727. <DataGridTemplateColumn.CellTemplate>
  728. <DataTemplate>
  729. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  730. </DataTemplate>
  731. </DataGridTemplateColumn.CellTemplate>
  732. </DataGridTemplateColumn>-->
  733. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  734. <DataGridTemplateColumn.CellTemplate>
  735. <DataTemplate>
  736. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  737. </DataTemplate>
  738. </DataGridTemplateColumn.CellTemplate>
  739. </DataGridTemplateColumn>-->
  740. </DataGrid.Columns>
  741. </DataGrid>
  742. <!-- 炒锅4配置 -->
  743. <DataGrid
  744. x:Name="fryFour"
  745. Grid.Row="1"
  746. AutoGenerateColumns="False"
  747. Background="Transparent"
  748. CellStyle="{StaticResource cellStyle}"
  749. ColumnHeaderStyle="{StaticResource ColumHeaderStyle}"
  750. EnableRowVirtualization="False"
  751. GridLinesVisibility="All"
  752. IsReadOnly="False"
  753. ItemsSource="{Binding FryFourVariables}"
  754. LoadingRow="fryFour_LoadingRow"
  755. RowStyle="{StaticResource rowStyle}"
  756. Style="{StaticResource dataGrid}"
  757. Visibility="Collapsed">
  758. <DataGrid.Columns>
  759. <DataGridTemplateColumn
  760. Width="0.1*"
  761. Header="ID"
  762. IsReadOnly="True">
  763. <DataGridTemplateColumn.CellTemplate>
  764. <DataTemplate>
  765. <TextBox
  766. IsReadOnly="True"
  767. Style="{StaticResource textboxStyle}"
  768. Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridRow}}, Path=Header}" />
  769. </DataTemplate>
  770. </DataGridTemplateColumn.CellTemplate>
  771. </DataGridTemplateColumn>
  772. <DataGridTextColumn
  773. Width="0.45*"
  774. Binding="{Binding PlcAddress}"
  775. ElementStyle="{StaticResource dgCellstyle}"
  776. Header="PLC地址"
  777. IsReadOnly="False" />
  778. <DataGridTextColumn
  779. Width="0.45*"
  780. Binding="{Binding Length}"
  781. ElementStyle="{StaticResource dgCellstyle}"
  782. Header="地址长度"
  783. IsReadOnly="False" />
  784. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  785. <DataGridTemplateColumn.CellTemplate>
  786. <DataTemplate>
  787. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  788. </DataTemplate>
  789. </DataGridTemplateColumn.CellTemplate>
  790. </DataGridTemplateColumn>-->
  791. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  792. <DataGridTemplateColumn.CellTemplate>
  793. <DataTemplate>
  794. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  795. </DataTemplate>
  796. </DataGridTemplateColumn.CellTemplate>
  797. </DataGridTemplateColumn>-->
  798. </DataGrid.Columns>
  799. </DataGrid>
  800. <!-- 炒锅5配置 -->
  801. <DataGrid
  802. x:Name="fryFive"
  803. Grid.Row="1"
  804. AutoGenerateColumns="False"
  805. Background="Transparent"
  806. CellStyle="{StaticResource cellStyle}"
  807. ColumnHeaderStyle="{StaticResource ColumHeaderStyle}"
  808. EnableRowVirtualization="False"
  809. GridLinesVisibility="All"
  810. IsReadOnly="False"
  811. ItemsSource="{Binding FryFiveVariables}"
  812. LoadingRow="fryFive_LoadingRow"
  813. RowStyle="{StaticResource rowStyle}"
  814. Style="{StaticResource dataGrid}"
  815. Visibility="Collapsed">
  816. <DataGrid.Columns>
  817. <DataGridTemplateColumn
  818. Width="0.1*"
  819. Header="ID"
  820. IsReadOnly="True">
  821. <DataGridTemplateColumn.CellTemplate>
  822. <DataTemplate>
  823. <TextBox
  824. IsReadOnly="True"
  825. Style="{StaticResource textboxStyle}"
  826. Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type DataGridRow}}, Path=Header}" />
  827. </DataTemplate>
  828. </DataGridTemplateColumn.CellTemplate>
  829. </DataGridTemplateColumn>
  830. <DataGridTextColumn
  831. Width="0.45*"
  832. Binding="{Binding PlcAddress}"
  833. ElementStyle="{StaticResource dgCellstyle}"
  834. Header="PLC地址"
  835. IsReadOnly="False" />
  836. <DataGridTextColumn
  837. Width="0.45*"
  838. Binding="{Binding Length}"
  839. ElementStyle="{StaticResource dgCellstyle}"
  840. Header="地址长度"
  841. IsReadOnly="False" />
  842. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  843. <DataGridTemplateColumn.CellTemplate>
  844. <DataTemplate>
  845. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  846. </DataTemplate>
  847. </DataGridTemplateColumn.CellTemplate>
  848. </DataGridTemplateColumn>-->
  849. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  850. <DataGridTemplateColumn.CellTemplate>
  851. <DataTemplate>
  852. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  853. </DataTemplate>
  854. </DataGridTemplateColumn.CellTemplate>
  855. </DataGridTemplateColumn>-->
  856. </DataGrid.Columns>
  857. </DataGrid>
  858. </Grid>
  859. </UserControl>