SetPlotConfigView.xaml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381
  1. <UserControl
  2. x:Class="ShakerManger.View.SetPlotConfigView"
  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:hc="https://handyorg.github.io/handycontrol"
  7. xmlns:local="clr-namespace:ShakerManger.View"
  8. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  9. xmlns:vm="clr-namespace:ShakerManger.ViewModel"
  10. Width="800"
  11. Height="616"
  12. d:DataContext="{d:DesignInstance {x:Type vm:ShakerControlViewModel}}"
  13. d:DesignHeight="450"
  14. d:DesignWidth="800"
  15. Foreground="{StaticResource LableBrush}"
  16. mc:Ignorable="d">
  17. <Border
  18. Background="{StaticResource MainBrush}"
  19. BorderBrush="{StaticResource AuxiliaryBrush}"
  20. BorderThickness="1"
  21. CornerRadius="6">
  22. <Grid>
  23. <Grid.RowDefinitions>
  24. <RowDefinition Height="46" />
  25. <RowDefinition Height="*" />
  26. </Grid.RowDefinitions>
  27. <Border Background="{StaticResource EmbellishBrush}" CornerRadius="6,6,0,0">
  28. <Grid>
  29. <Grid.ColumnDefinitions>
  30. <ColumnDefinition />
  31. <ColumnDefinition Width="66" />
  32. </Grid.ColumnDefinitions>
  33. <TextBlock
  34. Grid.ColumnSpan="2"
  35. HorizontalAlignment="Center"
  36. VerticalAlignment="Center"
  37. FontSize="36"
  38. Foreground="{StaticResource MainBrush}"
  39. Text="波形设置" />
  40. <Button
  41. Grid.Column="1"
  42. HorizontalAlignment="Center"
  43. VerticalAlignment="Center"
  44. hc:IconElement.Geometry="{StaticResource CloseGeometry}">
  45. <Button.Style>
  46. <Style TargetType="Button" BasedOn="{StaticResource ImageButton}">
  47. <Setter Property="Foreground" Value="{StaticResource MainBrush}" />
  48. </Style>
  49. </Button.Style>
  50. <hc:Interaction.Triggers>
  51. <hc:EventTrigger EventName="Click">
  52. <hc:SetPropertyAction
  53. PropertyName="SetPlotConfigIsOpen"
  54. PropertyValue="False"
  55. TargetObject="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Button}, Path=DataContext}" />
  56. </hc:EventTrigger>
  57. </hc:Interaction.Triggers>
  58. </Button>
  59. </Grid>
  60. </Border>
  61. <ListView
  62. Grid.Row="1"
  63. Margin="10"
  64. ItemsSource="{Binding PlotConfig}">
  65. <ListView.Style>
  66. <Style TargetType="ListView">
  67. <Setter Property="Background" Value="White" />
  68. <Setter Property="BorderBrush" Value="Transparent" />
  69. <Setter Property="Padding" Value="0" />
  70. <Setter Property="Template">
  71. <Setter.Value>
  72. <ControlTemplate TargetType="{x:Type ListView}">
  73. <Border
  74. BorderBrush="{StaticResource AuxiliaryBrush}"
  75. BorderThickness="1"
  76. CornerRadius="6,6,0,0">
  77. <Grid>
  78. <Grid.RowDefinitions>
  79. <RowDefinition Height="42" />
  80. <RowDefinition Height="*" />
  81. </Grid.RowDefinitions>
  82. <Border Background="{StaticResource EmbellishBrush}" CornerRadius="6,6,0,0">
  83. <Grid>
  84. <Grid.ColumnDefinitions>
  85. <ColumnDefinition Width="46" />
  86. <ColumnDefinition Width="280" />
  87. <ColumnDefinition Width="126" />
  88. <ColumnDefinition Width="126" />
  89. <ColumnDefinition Width="80" />
  90. <ColumnDefinition Width="120" />
  91. </Grid.ColumnDefinitions>
  92. <Line
  93. HorizontalAlignment="Right"
  94. Stroke="{StaticResource AuxiliaryBrush}"
  95. StrokeThickness="1"
  96. X1="0"
  97. X2="0"
  98. Y1="0"
  99. Y2="42" />
  100. <Line
  101. Grid.Column="1"
  102. HorizontalAlignment="Right"
  103. Stroke="{StaticResource AuxiliaryBrush}"
  104. StrokeThickness="1"
  105. X1="0"
  106. X2="0"
  107. Y1="0"
  108. Y2="42" />
  109. <Line
  110. Grid.Column="2"
  111. HorizontalAlignment="Right"
  112. Stroke="{StaticResource AuxiliaryBrush}"
  113. StrokeThickness="1"
  114. X1="0"
  115. X2="0"
  116. Y1="0"
  117. Y2="42" />
  118. <Line
  119. Grid.Column="3"
  120. HorizontalAlignment="Right"
  121. Stroke="{StaticResource AuxiliaryBrush}"
  122. StrokeThickness="1"
  123. X1="0"
  124. X2="0"
  125. Y1="0"
  126. Y2="42" />
  127. <Line
  128. Grid.Column="4"
  129. HorizontalAlignment="Right"
  130. Stroke="{StaticResource AuxiliaryBrush}"
  131. StrokeThickness="1"
  132. X1="0"
  133. X2="0"
  134. Y1="0"
  135. Y2="42" />
  136. <TextBlock
  137. HorizontalAlignment="Center"
  138. VerticalAlignment="Center"
  139. FontSize="14"
  140. Foreground="{StaticResource MainBrush}"
  141. Text="可见" />
  142. <TextBlock
  143. Grid.Column="1"
  144. HorizontalAlignment="Center"
  145. VerticalAlignment="Center"
  146. FontSize="14"
  147. Foreground="{StaticResource MainBrush}"
  148. Text="曲线名称" />
  149. <TextBlock
  150. Grid.Column="2"
  151. HorizontalAlignment="Center"
  152. VerticalAlignment="Center"
  153. FontSize="14"
  154. Foreground="{StaticResource MainBrush}"
  155. Text="数据点样式" />
  156. <TextBlock
  157. Grid.Column="3"
  158. HorizontalAlignment="Center"
  159. VerticalAlignment="Center"
  160. FontSize="14"
  161. Foreground="{StaticResource MainBrush}"
  162. Text="曲线样式" />
  163. <TextBlock
  164. Grid.Column="4"
  165. HorizontalAlignment="Center"
  166. VerticalAlignment="Center"
  167. FontSize="14"
  168. Foreground="{StaticResource MainBrush}"
  169. Text="线宽" />
  170. <TextBlock
  171. Grid.Column="5"
  172. HorizontalAlignment="Center"
  173. VerticalAlignment="Center"
  174. FontSize="14"
  175. Foreground="{StaticResource MainBrush}"
  176. Text="曲线颜色" />
  177. </Grid>
  178. </Border>
  179. <ScrollViewer
  180. Grid.Row="1"
  181. HorizontalScrollBarVisibility="Hidden"
  182. VerticalScrollBarVisibility="Hidden">
  183. <ItemsPresenter Margin="0" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
  184. </ScrollViewer>
  185. </Grid>
  186. </Border>
  187. </ControlTemplate>
  188. </Setter.Value>
  189. </Setter>
  190. <Setter Property="ItemTemplate">
  191. <Setter.Value>
  192. <DataTemplate>
  193. <Grid>
  194. <Grid.ColumnDefinitions>
  195. <ColumnDefinition Width="46" />
  196. <ColumnDefinition Width="280" />
  197. <ColumnDefinition Width="126" />
  198. <ColumnDefinition Width="126" />
  199. <ColumnDefinition Width="80" />
  200. <ColumnDefinition Width="120" />
  201. </Grid.ColumnDefinitions>
  202. <Line
  203. Grid.ColumnSpan="6"
  204. VerticalAlignment="Bottom"
  205. Stroke="{StaticResource AuxiliaryBrush}"
  206. StrokeThickness="1"
  207. X1="0"
  208. X2="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Border}, Path=ActualWidth}"
  209. Y1="0"
  210. Y2="0" />
  211. <Line
  212. HorizontalAlignment="Right"
  213. Stroke="{StaticResource AuxiliaryBrush}"
  214. StrokeThickness="1"
  215. X1="0"
  216. X2="0"
  217. Y1="0"
  218. Y2="42" />
  219. <Line
  220. Grid.Column="1"
  221. HorizontalAlignment="Right"
  222. Stroke="{StaticResource AuxiliaryBrush}"
  223. StrokeThickness="1"
  224. X1="0"
  225. X2="0"
  226. Y1="0"
  227. Y2="42" />
  228. <Line
  229. Grid.Column="2"
  230. HorizontalAlignment="Right"
  231. Stroke="{StaticResource AuxiliaryBrush}"
  232. StrokeThickness="1"
  233. X1="0"
  234. X2="0"
  235. Y1="0"
  236. Y2="42" />
  237. <Line
  238. Grid.Column="3"
  239. HorizontalAlignment="Right"
  240. Stroke="{StaticResource AuxiliaryBrush}"
  241. StrokeThickness="1"
  242. X1="0"
  243. X2="0"
  244. Y1="0"
  245. Y2="42" />
  246. <Line
  247. Grid.Column="4"
  248. HorizontalAlignment="Right"
  249. Stroke="{StaticResource AuxiliaryBrush}"
  250. StrokeThickness="1"
  251. X1="0"
  252. X2="0"
  253. Y1="0"
  254. Y2="42" />
  255. <CheckBox
  256. HorizontalAlignment="Center"
  257. VerticalAlignment="Center"
  258. FontSize="14"
  259. IsChecked="{Binding IsVisible}" />
  260. <TextBlock
  261. Grid.Column="1"
  262. Width="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Border, AncestorLevel=1}, Path=Width}"
  263. HorizontalAlignment="Center"
  264. VerticalAlignment="Center"
  265. Background="Transparent"
  266. FontSize="14"
  267. IsEnabled="{Binding IsVisible}"
  268. Text="{Binding Name, Mode=OneWay}">
  269. <TextBlock.Style>
  270. <Style TargetType="TextBlock">
  271. <Style.Triggers>
  272. <Trigger Property="IsEnabled" Value="False">
  273. <Setter Property="Foreground" Value="{StaticResource TextInfoBrush}" />
  274. </Trigger>
  275. </Style.Triggers>
  276. </Style>
  277. </TextBlock.Style>
  278. </TextBlock>
  279. <ComboBox
  280. Grid.Column="2"
  281. Width="126"
  282. Height="42"
  283. HorizontalAlignment="Center"
  284. VerticalAlignment="Center"
  285. Background="Transparent"
  286. DisplayMemberPath="Description"
  287. IsEnabled="{Binding IsVisible}"
  288. ItemsSource="{Binding MarkerType, Converter={StaticResource EnumToCollectionConverter}, ConverterParameter='0,1,2,3,4,5,6,7', Mode=OneTime}"
  289. SelectedValue="{Binding MarkerType}"
  290. SelectedValuePath="Value"
  291. Style="{StaticResource ComboBoxStyle1}" />
  292. <ComboBox
  293. Grid.Column="3"
  294. Width="126"
  295. Height="42"
  296. HorizontalAlignment="Center"
  297. VerticalAlignment="Center"
  298. Background="Transparent"
  299. DisplayMemberPath="Description"
  300. IsEnabled="{Binding IsVisible}"
  301. ItemsSource="{Binding LineStyle, Converter={StaticResource EnumToCollectionConverter}, Mode=OneTime}"
  302. SelectedValue="{Binding LineStyle}"
  303. SelectedValuePath="Value"
  304. Style="{StaticResource ComboBoxStyle1}" />
  305. <hc:NumericUpDown
  306. Grid.Column="4"
  307. Width="80"
  308. Height="42"
  309. HorizontalAlignment="Center"
  310. VerticalAlignment="Center"
  311. HorizontalContentAlignment="Center"
  312. Background="Transparent"
  313. CaretBrush="{Binding RelativeSource={RelativeSource Mode=Self}, Path=Foreground}"
  314. FontSize="14"
  315. Increment="1"
  316. IsEnabled="{Binding IsVisible}"
  317. Maximum="20"
  318. Minimum="1"
  319. Value="{Binding StrokeThickness}" />
  320. <Border
  321. x:Name="color"
  322. Grid.Column="5"
  323. Background="{Binding StrokeColor, Converter={StaticResource OxyPlotColorToSolidBrushConverter}}"
  324. Cursor="Hand"
  325. IsEnabled="{Binding IsVisible}">
  326. <hc:Interaction.Triggers>
  327. <hc:EventTrigger EventName="MouseUp">
  328. <hc:SetPropertyAction
  329. PropertyName="PlotConfig"
  330. PropertyValue="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=Border}, Path=DataContext}"
  331. TargetObject="{StaticResource ColorPicker}" />
  332. <hc:SetPropertyAction
  333. PropertyName="IsOpen"
  334. PropertyValue="True"
  335. TargetObject="{StaticResource ColorPicker}" />
  336. </hc:EventTrigger>
  337. </hc:Interaction.Triggers>
  338. </Border>
  339. </Grid>
  340. </DataTemplate>
  341. </Setter.Value>
  342. </Setter>
  343. <Setter Property="ItemContainerStyle">
  344. <Setter.Value>
  345. <Style TargetType="ListViewItem">
  346. <Setter Property="Height" Value="42" />
  347. <Setter Property="Background" Value="Transparent" />
  348. <Setter Property="BorderBrush" Value="Transparent" />
  349. <Setter Property="BorderThickness" Value="0" />
  350. <Setter Property="SnapsToDevicePixels" Value="True" />
  351. <Setter Property="OverridesDefaultStyle" Value="True" />
  352. <Setter Property="Cursor" Value="Hand" />
  353. <Setter Property="IsEnabled" Value="True" />
  354. <Setter Property="Template">
  355. <Setter.Value>
  356. <ControlTemplate TargetType="ListViewItem">
  357. <ContentPresenter />
  358. </ControlTemplate>
  359. </Setter.Value>
  360. </Setter>
  361. </Style>
  362. </Setter.Value>
  363. </Setter>
  364. </Style>
  365. </ListView.Style>
  366. </ListView>
  367. </Grid>
  368. </Border>
  369. </UserControl>