终端一体化运控平台
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

574 rader
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}" SelectedValue="滚筒输送线" Style="{StaticResource ComboBoxStyle1}"
  373. VerticalContentAlignment="Center" SelectionChanged="ComboBox_SelectionChanged" FontSize="20" Foreground="#FF2AB2E7" Width="130" Height="40" Margin="0,0,10,0"></ComboBox>
  374. <Button HorizontalAlignment="Right" Width="120" Height="40" Margin="0,0,10,0" Background="Transparent" Content="保存配置" Foreground="#FF2AB2E7" FontSize="20" BorderBrush="LightSkyBlue" BorderThickness="1" Command="{Binding SaveDataCommand}"></Button>
  375. </StackPanel>
  376. <!--变量配置-->
  377. <DataGrid Name="GT" Grid.Row="1" ItemsSource="{Binding Variables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False"
  378. AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}"
  379. LoadingRow="DataGrid_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
  380. <DataGrid.Columns>
  381. <DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
  382. <DataGridTemplateColumn.CellTemplate>
  383. <DataTemplate>
  384. <TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
  385. </DataTemplate>
  386. </DataGridTemplateColumn.CellTemplate>
  387. </DataGridTemplateColumn>
  388. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }">
  389. </DataGridTextColumn>
  390. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }">
  391. </DataGridTextColumn>
  392. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  393. <DataGridTemplateColumn.CellTemplate>
  394. <DataTemplate>
  395. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  396. </DataTemplate>
  397. </DataGridTemplateColumn.CellTemplate>
  398. </DataGridTemplateColumn>-->
  399. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  400. <DataGridTemplateColumn.CellTemplate>
  401. <DataTemplate>
  402. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  403. </DataTemplate>
  404. </DataGridTemplateColumn.CellTemplate>
  405. </DataGridTemplateColumn>-->
  406. </DataGrid.Columns>
  407. </DataGrid>
  408. <!--炒锅1配置-->
  409. <DataGrid x:Name="fryOne" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryOneVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False"
  410. AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}"
  411. LoadingRow="fryOne_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
  412. <DataGrid.Columns>
  413. <DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
  414. <DataGridTemplateColumn.CellTemplate>
  415. <DataTemplate>
  416. <TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
  417. </DataTemplate>
  418. </DataGridTemplateColumn.CellTemplate>
  419. </DataGridTemplateColumn>
  420. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }">
  421. </DataGridTextColumn>
  422. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }">
  423. </DataGridTextColumn>
  424. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  425. <DataGridTemplateColumn.CellTemplate>
  426. <DataTemplate>
  427. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  428. </DataTemplate>
  429. </DataGridTemplateColumn.CellTemplate>
  430. </DataGridTemplateColumn>-->
  431. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  432. <DataGridTemplateColumn.CellTemplate>
  433. <DataTemplate>
  434. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  435. </DataTemplate>
  436. </DataGridTemplateColumn.CellTemplate>
  437. </DataGridTemplateColumn>-->
  438. </DataGrid.Columns>
  439. </DataGrid>
  440. <!--炒锅2配置-->
  441. <DataGrid x:Name="fryTwo" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryTwoVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False"
  442. AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}"
  443. LoadingRow="fryTwo_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
  444. <DataGrid.Columns>
  445. <DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
  446. <DataGridTemplateColumn.CellTemplate>
  447. <DataTemplate>
  448. <TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
  449. </DataTemplate>
  450. </DataGridTemplateColumn.CellTemplate>
  451. </DataGridTemplateColumn>
  452. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }">
  453. </DataGridTextColumn>
  454. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }">
  455. </DataGridTextColumn>
  456. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  457. <DataGridTemplateColumn.CellTemplate>
  458. <DataTemplate>
  459. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  460. </DataTemplate>
  461. </DataGridTemplateColumn.CellTemplate>
  462. </DataGridTemplateColumn>-->
  463. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  464. <DataGridTemplateColumn.CellTemplate>
  465. <DataTemplate>
  466. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  467. </DataTemplate>
  468. </DataGridTemplateColumn.CellTemplate>
  469. </DataGridTemplateColumn>-->
  470. </DataGrid.Columns>
  471. </DataGrid>
  472. <!--炒锅3配置-->
  473. <DataGrid x:Name="fryThree" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryThreeVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False"
  474. AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}"
  475. LoadingRow="fryThree_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
  476. <DataGrid.Columns>
  477. <DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
  478. <DataGridTemplateColumn.CellTemplate>
  479. <DataTemplate>
  480. <TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
  481. </DataTemplate>
  482. </DataGridTemplateColumn.CellTemplate>
  483. </DataGridTemplateColumn>
  484. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }">
  485. </DataGridTextColumn>
  486. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }">
  487. </DataGridTextColumn>
  488. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  489. <DataGridTemplateColumn.CellTemplate>
  490. <DataTemplate>
  491. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  492. </DataTemplate>
  493. </DataGridTemplateColumn.CellTemplate>
  494. </DataGridTemplateColumn>-->
  495. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  496. <DataGridTemplateColumn.CellTemplate>
  497. <DataTemplate>
  498. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  499. </DataTemplate>
  500. </DataGridTemplateColumn.CellTemplate>
  501. </DataGridTemplateColumn>-->
  502. </DataGrid.Columns>
  503. </DataGrid>
  504. <!--炒锅4配置-->
  505. <DataGrid x:Name="fryFour" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryFourVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False"
  506. AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}"
  507. LoadingRow="fryFour_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
  508. <DataGrid.Columns>
  509. <DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
  510. <DataGridTemplateColumn.CellTemplate>
  511. <DataTemplate>
  512. <TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
  513. </DataTemplate>
  514. </DataGridTemplateColumn.CellTemplate>
  515. </DataGridTemplateColumn>
  516. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }">
  517. </DataGridTextColumn>
  518. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }">
  519. </DataGridTextColumn>
  520. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址">
  521. <DataGridTemplateColumn.CellTemplate>
  522. <DataTemplate>
  523. <TextBox Text="{Binding PlcAddress}" Style="{StaticResource textboxStyle}"></TextBox>
  524. </DataTemplate>
  525. </DataGridTemplateColumn.CellTemplate>
  526. </DataGridTemplateColumn>-->
  527. <!--<DataGridTemplateColumn IsReadOnly="False" Width="0.45*" Header="地址长度">
  528. <DataGridTemplateColumn.CellTemplate>
  529. <DataTemplate>
  530. <TextBox Text="{Binding Length}" Style="{StaticResource textboxStyle}"></TextBox>
  531. </DataTemplate>
  532. </DataGridTemplateColumn.CellTemplate>
  533. </DataGridTemplateColumn>-->
  534. </DataGrid.Columns>
  535. </DataGrid>
  536. <!--炒锅5配置-->
  537. <DataGrid x:Name="fryFive" Grid.Row="1" Visibility="Collapsed" ItemsSource="{Binding FryFiveVariables}" GridLinesVisibility="All" Background="Transparent" EnableRowVirtualization="False"
  538. AutoGenerateColumns="False" IsReadOnly="False" Style="{StaticResource dataGrid}"
  539. LoadingRow="fryFive_LoadingRow" ColumnHeaderStyle="{StaticResource ColumHeaderStyle}" RowStyle="{StaticResource rowStyle}" CellStyle="{StaticResource cellStyle}">
  540. <DataGrid.Columns>
  541. <DataGridTemplateColumn IsReadOnly="True" Width="0.1*" Header="ID">
  542. <DataGridTemplateColumn.CellTemplate>
  543. <DataTemplate>
  544. <TextBox Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type DataGridRow}}, Path=Header}" IsReadOnly="True" Style="{StaticResource textboxStyle}"></TextBox>
  545. </DataTemplate>
  546. </DataGridTemplateColumn.CellTemplate>
  547. </DataGridTemplateColumn>
  548. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="PLC地址" Binding="{Binding PlcAddress}" ElementStyle="{StaticResource dgCellstyle }">
  549. </DataGridTextColumn>
  550. <DataGridTextColumn IsReadOnly="False" Width="0.45*" Header="地址长度" Binding="{Binding Length}" ElementStyle="{StaticResource dgCellstyle }">
  551. </DataGridTextColumn>
  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. </Grid>
  569. </UserControl>