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

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