ParamsSetPage.xaml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <Window x:Class="MuchInfo.Chart.FormulaEdit.ParamsSetPage"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. xmlns:Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Classic"
  5. xmlns:formulaEdit="clr-namespace:MuchInfo.Chart.FormulaEdit"
  6. Title="参数设置"
  7. Width="450"
  8. Height="319"
  9. Foreground="{DynamicResource MuchinfoBrush6}"
  10. Icon="Image/fsSelect.ico"
  11. ResizeMode="NoResize"
  12. WindowStartupLocation="CenterOwner">
  13. <Window.Resources>
  14. <DataTemplate x:Key="ParamsTemplate">
  15. <Grid>
  16. <Grid.ColumnDefinitions>
  17. <ColumnDefinition Width="2*" />
  18. <ColumnDefinition Width="3*" />
  19. </Grid.ColumnDefinitions>
  20. <TextBlock Margin="5,0"
  21. HorizontalAlignment="Right"
  22. Text="{Binding Key}" />
  23. <formulaEdit:NumberTextBox Grid.Column="1" Text="{Binding Value.Value, Mode=TwoWay}" />
  24. </Grid>
  25. </DataTemplate>
  26. <Style x:Key="ParamInputStyle" TargetType="{x:Type ListBox}">
  27. <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
  28. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.WindowTextBrushKey}}" />
  29. <Setter Property="BorderThickness" Value="2" />
  30. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
  31. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
  32. <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
  33. <Setter Property="ScrollViewer.PanningMode" Value="Both" />
  34. <Setter Property="Stylus.IsFlicksEnabled" Value="False" />
  35. <Setter Property="VerticalContentAlignment" Value="Center" />
  36. <Setter Property="Template">
  37. <Setter.Value>
  38. <ControlTemplate TargetType="{x:Type ListBox}">
  39. <ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
  40. <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  41. </ScrollViewer>
  42. <ControlTemplate.Triggers>
  43. <MultiTrigger>
  44. <MultiTrigger.Conditions>
  45. <Condition Property="IsGrouping" Value="true" />
  46. </MultiTrigger.Conditions>
  47. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  48. </MultiTrigger>
  49. </ControlTemplate.Triggers>
  50. </ControlTemplate>
  51. </Setter.Value>
  52. </Setter>
  53. </Style>
  54. <Style x:Key="ParamEditItemStyle" TargetType="{x:Type ListBoxItem}">
  55. <Setter Property="Background" Value="Transparent" />
  56. <Setter Property="HorizontalContentAlignment" Value="Stretch" />
  57. <Setter Property="VerticalContentAlignment" Value="Center" />
  58. <Setter Property="Padding" Value="2,5" />
  59. <Setter Property="Template">
  60. <Setter.Value>
  61. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  62. <Border x:Name="Bd"
  63. Background="{TemplateBinding Background}"
  64. BorderBrush="{TemplateBinding BorderBrush}"
  65. BorderThickness="{TemplateBinding BorderThickness}"
  66. Padding="{TemplateBinding Padding}"
  67. SnapsToDevicePixels="true">
  68. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  69. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  70. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  71. </Border>
  72. <ControlTemplate.Triggers>
  73. <Trigger Property="IsEnabled" Value="false">
  74. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  75. </Trigger>
  76. </ControlTemplate.Triggers>
  77. </ControlTemplate>
  78. </Setter.Value>
  79. </Setter>
  80. </Style>
  81. <Style x:Key="ListBoxStyle1" TargetType="{x:Type ListBox}">
  82. <Setter Property="Foreground" Value="{DynamicResource MuchinfoBrush13}" />
  83. <Setter Property="BorderBrush" Value="{DynamicResource MuchinfoBrush6}" />
  84. <Setter Property="BorderThickness" Value="2" />
  85. <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto" />
  86. <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
  87. <Setter Property="ScrollViewer.CanContentScroll" Value="true" />
  88. <Setter Property="VerticalContentAlignment" Value="Center" />
  89. <Setter Property="Template">
  90. <Setter.Value>
  91. <ControlTemplate TargetType="{x:Type ListBox}">
  92. <Border x:Name="Bd"
  93. Background="{TemplateBinding Background}"
  94. BorderBrush="{TemplateBinding BorderBrush}"
  95. BorderThickness="{TemplateBinding BorderThickness}"
  96. SnapsToDevicePixels="true">
  97. <ScrollViewer Focusable="false" Padding="{TemplateBinding Padding}">
  98. <ItemsPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  99. </ScrollViewer>
  100. </Border>
  101. <ControlTemplate.Triggers>
  102. <Trigger Property="IsEnabled" Value="false">
  103. <Setter TargetName="Bd" Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}" />
  104. </Trigger>
  105. <Trigger Property="IsGrouping" Value="true">
  106. <Setter Property="ScrollViewer.CanContentScroll" Value="false" />
  107. </Trigger>
  108. </ControlTemplate.Triggers>
  109. </ControlTemplate>
  110. </Setter.Value>
  111. </Setter>
  112. </Style>
  113. <Style x:Key="ListBoxItemStyle1" TargetType="{x:Type ListBoxItem}">
  114. <Setter Property="Background" Value="Transparent" />
  115. <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
  116. <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}" />
  117. <Setter Property="Padding" Value="2,0,0,0" />
  118. <Setter Property="Template">
  119. <Setter.Value>
  120. <ControlTemplate TargetType="{x:Type ListBoxItem}">
  121. <Border x:Name="Bd"
  122. Background="{TemplateBinding Background}"
  123. BorderBrush="{TemplateBinding BorderBrush}"
  124. BorderThickness="{TemplateBinding BorderThickness}"
  125. Padding="{TemplateBinding Padding}"
  126. SnapsToDevicePixels="true">
  127. <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
  128. VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
  129. SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  130. </Border>
  131. <ControlTemplate.Triggers>
  132. <Trigger Property="IsSelected" Value="true">
  133. <Setter TargetName="Bd" Property="Background" Value="{DynamicResource MuchinfoBrush49}" />
  134. <Setter Property="Foreground" Value="{DynamicResource MuchinfoBrush3}" />
  135. </Trigger>
  136. <MultiTrigger>
  137. <MultiTrigger.Conditions>
  138. <Condition Property="IsSelected" Value="true" />
  139. <Condition Property="Selector.IsSelectionActive" Value="false" />
  140. </MultiTrigger.Conditions>
  141. </MultiTrigger>
  142. <Trigger Property="IsEnabled" Value="false">
  143. <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}" />
  144. </Trigger>
  145. </ControlTemplate.Triggers>
  146. </ControlTemplate>
  147. </Setter.Value>
  148. </Setter>
  149. </Style>
  150. </Window.Resources>
  151. <Grid>
  152. <Grid.ColumnDefinitions>
  153. <ColumnDefinition Width="*" />
  154. <ColumnDefinition Width="*" />
  155. <ColumnDefinition Width="*" />
  156. </Grid.ColumnDefinitions>
  157. <Grid.RowDefinitions>
  158. <RowDefinition Height="Auto" />
  159. <RowDefinition />
  160. <RowDefinition Height="50" />
  161. </Grid.RowDefinitions>
  162. <TextBlock Margin="10,5" Text="公式名称" />
  163. <ListBox x:Name="lboxFormula"
  164. Grid.Row="1"
  165. Margin="10,0"
  166. DisplayMemberPath="Name"
  167. ItemContainerStyle="{DynamicResource ListBoxItemStyle1}"
  168. ItemsSource="{Binding ProgramModels}"
  169. SelectedItem="{Binding SelectProgramModel}"
  170. Style="{DynamicResource ListBoxStyle1}" />
  171. <TextBlock Grid.Column="1"
  172. Margin="0,5"
  173. Text="参数设置" />
  174. <ListBox Grid.Row="1"
  175. Grid.Column="1"
  176. ItemContainerStyle="{DynamicResource ParamEditItemStyle}"
  177. ItemTemplate="{DynamicResource ParamsTemplate}"
  178. ItemsSource="{Binding SelectedItem.CustomParams,
  179. ElementName=lboxFormula}"
  180. Style="{DynamicResource ParamInputStyle}" />
  181. <Button Grid.Row="1"
  182. Grid.Column="2"
  183. Margin="10,5"
  184. VerticalAlignment="Center"
  185. Click="btnEditFormula_OnClick"
  186. Content="编辑公式"
  187. Style="{DynamicResource CommonButtonStyle}" />
  188. <Button Grid.Row="2"
  189. Grid.Column="1"
  190. MinWidth="80"
  191. HorizontalAlignment="Center"
  192. VerticalAlignment="Center"
  193. Click="ButtonBase_OnClick"
  194. Command="{Binding ConfirmCommand}"
  195. Content="确定"
  196. Style="{DynamicResource CommonButtonStyle}" />
  197. <Button Grid.Row="2"
  198. Grid.Column="2"
  199. MinWidth="80"
  200. HorizontalAlignment="Center"
  201. VerticalAlignment="Center"
  202. Click="btnCancel_OnClick"
  203. Content="取消"
  204. Style="{DynamicResource CommonButtonStyle}" />
  205. </Grid>
  206. </Window>