DataHistoryView.xaml 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <UserControl x:Class="Venus_MainPages.Views.DataHistoryView"
  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:Venus_MainPages.Views"
  7. mc:Ignorable="d"
  8. xmlns:wfi ="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
  9. xmlns:wf ="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
  10. xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
  11. xmlns:prism="http://prismlibrary.com/"
  12. prism:ViewModelLocator.AutoWireViewModel="True"
  13. xmlns:ctrls="clr-namespace:Venus_Themes.UserControls;assembly=Venus_Themes"
  14. d:DesignHeight="450" d:DesignWidth="800" x:Name="dataHistoryView">
  15. <i:Interaction.Triggers>
  16. <i:EventTrigger EventName="Loaded">
  17. <i:InvokeCommandAction Command="{Binding LoadCommand}" CommandParameter="{Binding ElementName=dataHistoryView}"/>
  18. </i:EventTrigger>
  19. </i:Interaction.Triggers>
  20. <Grid>
  21. <Grid.ColumnDefinitions>
  22. <ColumnDefinition Width="auto"/>
  23. <ColumnDefinition />
  24. </Grid.ColumnDefinitions>
  25. <Expander ExpandDirection="Left">
  26. <StackPanel>
  27. <StackPanel>
  28. <TextBlock Text="Start Time:" Width="70" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" Margin="5,0,0,0"/>
  29. <wfi:WindowsFormsHost Margin="5,0,0,0" FontSize="14" FontFamily="Arial" Width="170" Height="40" HorizontalAlignment="Left">
  30. <wf:DateTimePicker x:Name="wfTimeFrom" Value="2011-8-1" CustomFormat="yyyy/MM/dd HH:mm:ss" Format="Custom"></wf:DateTimePicker>
  31. </wfi:WindowsFormsHost>
  32. <TextBlock Text="End Time:" Width="70" FontFamily="Arial" FontSize="14" Foreground="{DynamicResource FG_Black}" HorizontalAlignment="Left" Margin="5,0,0,0"/>
  33. <wfi:WindowsFormsHost Margin="5,0,0,0" FontSize="14" FontFamily="Arial" Width="170" Height="22" HorizontalAlignment="Left">
  34. <wf:DateTimePicker x:Name="wfTimeTo" Value="2013-8-1" CustomFormat="yyyy/MM/dd HH:mm:ss" Format="Custom"></wf:DateTimePicker>
  35. </wfi:WindowsFormsHost>
  36. <StackPanel Orientation="Horizontal">
  37. <Button Content="Search" Command="{Binding StartCommand}" Width="80" Height="20" HorizontalAlignment="Left" Margin="5,10,0,0" IsEnabled="{Binding ElementName=TimeDataCheckBox,Path=IsChecked,Converter={StaticResource BoolToBool}}"/>
  38. <Button Content="Clear" Command="{Binding ClearCommand}" Width="80" Height="20" HorizontalAlignment="Left" Margin="5,10,0,0"/>
  39. </StackPanel>
  40. </StackPanel>
  41. <Border BorderBrush="{DynamicResource Table_BD}" BorderThickness="1" Background="{DynamicResource Table_BG_Content}" Padding="5,1">
  42. <TreeView x:Name="ParameterTreeView" ItemsSource="{Binding ParameterNodes}" Canvas.Top="100" Height="450">
  43. <TreeView.ItemTemplate>
  44. <HierarchicalDataTemplate ItemsSource="{Binding ChildNodes}">
  45. <StackPanel Orientation="Horizontal">
  46. <CheckBox IsChecked="{Binding Selected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" >
  47. <i:Interaction.Triggers>
  48. <i:EventTrigger EventName="Click">
  49. <i:InvokeCommandAction Command="{Binding DataContext.ParameterCheckCommand, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=TreeView}}" CommandParameter="{Binding }"/>
  50. </i:EventTrigger>
  51. </i:Interaction.Triggers>
  52. </CheckBox>
  53. <TextBlock Text="{Binding Name}" />
  54. </StackPanel>
  55. </HierarchicalDataTemplate>
  56. </TreeView.ItemTemplate>
  57. </TreeView>
  58. </Border>
  59. <!--<ListBox ItemsSource="{Binding KeyDataObservableCollection}" Margin="20,0,0,0" FontSize="20" Height="200" VerticalAlignment="Bottom">
  60. <ListBox.ItemTemplate>
  61. <DataTemplate>
  62. <StackPanel Orientation="Horizontal">
  63. <TextBlock Text="{Binding Key}" Width="480"/>
  64. <Ellipse Fill="{Binding Color}" Width="20" Height="20" Margin="10,0,0,0"/>
  65. </StackPanel>
  66. </DataTemplate>
  67. </ListBox.ItemTemplate>
  68. </ListBox>-->
  69. <DataGrid Grid.Row="1" x:Name="dataGrid_DataList" AutoGenerateColumns="False" Background="#FFD6D6D6"
  70. ItemsSource="{Binding KeyDataObservableCollection, Mode=TwoWay}" SelectionMode="Extended" SelectionUnit="FullRow" CanUserResizeRows="False" CanUserSortColumns="False" CanUserResizeColumns="False" CanUserReorderColumns="False" CanUserDeleteRows="True" CanUserAddRows="False" Focusable="False" HorizontalGridLinesBrush="Gray" VerticalGridLinesBrush="Gray" HeadersVisibility="Column" Margin="0,5,0,0" Height="200">
  71. <DataGrid.Columns>
  72. <DataGridTextColumn Width="3*" Binding="{Binding Key,Mode=TwoWay}" CanUserSort="False" IsReadOnly="True">
  73. <DataGridTextColumn.CellStyle>
  74. <Style TargetType="DataGridCell">
  75. <Setter Property="ToolTip" Value="{Binding Key}" />
  76. </Style>
  77. </DataGridTextColumn.CellStyle>
  78. <DataGridTextColumn.HeaderTemplate >
  79. <DataTemplate>
  80. <TextBlock Text="Name"/>
  81. </DataTemplate>
  82. </DataGridTextColumn.HeaderTemplate>
  83. </DataGridTextColumn>
  84. <DataGridTemplateColumn Width="*" CanUserSort="True">
  85. <DataGridTemplateColumn.CellTemplate>
  86. <DataTemplate>
  87. <Button Focusable="False" Width="42" FontSize="11" Height="20" Tag="{Binding UniqueId}" Background="{Binding Color,UpdateSourceTrigger=PropertyChanged}" Click="OnChangeLineColor"/>
  88. </DataTemplate>
  89. </DataGridTemplateColumn.CellTemplate>
  90. <DataGridTemplateColumn.HeaderTemplate >
  91. <DataTemplate>
  92. <TextBlock Text="Color" />
  93. </DataTemplate>
  94. </DataGridTemplateColumn.HeaderTemplate>
  95. </DataGridTemplateColumn>
  96. </DataGrid.Columns>
  97. </DataGrid>
  98. </StackPanel>
  99. </Expander>
  100. <Grid Grid.Column="1">
  101. <Grid.RowDefinitions>
  102. <RowDefinition Height="60"/>
  103. <RowDefinition/>
  104. </Grid.RowDefinitions>
  105. <!--<Border BorderThickness="1" BorderBrush="Black" Margin="50,5,20,5">-->
  106. <StackPanel Orientation="Horizontal">
  107. <CheckBox HorizontalAlignment="Center" FontSize="20" Padding="3,-5,0,0" Margin="100,25,0,0" Content="AutoX Zoom" x:Name="AutoXCheckBox"/>
  108. <CheckBox HorizontalAlignment="Center" FontSize="20" Padding="3,-5,0,0" Margin="100,25,0,0" Content="AutoY Zoom" x:Name="AutoYCheckBox"/>
  109. <CheckBox HorizontalAlignment="Center" FontSize="20" Padding="3,-5,0,0" Margin="100,25,0,0" Content="查看实时数据" x:Name="TimeDataCheckBox">
  110. <i:Interaction.Triggers>
  111. <i:EventTrigger EventName="Checked">
  112. <i:InvokeCommandAction Command="{Binding StartRealTimeCommand}" CommandParameter="{Binding ElementName=TimeDataCheckBox}"/>
  113. </i:EventTrigger>
  114. <i:EventTrigger EventName="Unchecked">
  115. <i:InvokeCommandAction Command="{Binding StopRealTimeCommand}"/>
  116. </i:EventTrigger>
  117. </i:Interaction.Triggers>
  118. </CheckBox>
  119. </StackPanel>
  120. <!--</Border>-->
  121. <ctrls:DrawGraphicsControl x:Name="MyDrawGraphicsControl" Grid.Row="1" IsHorizontalNavigationEnabled="{Binding ElementName=AutoXCheckBox,Path=IsChecked}" IsVerticalNavigationEnabled="{Binding ElementName=AutoYCheckBox,Path=IsChecked}" WavePlotOriginX="{Binding ElementName=MinXTextBox,Path=Text}" WavePlotOriginWidth="{Binding ElementName=MaxXTextBox,Path=Text}" WavePlotOriginY="{Binding ElementName=MinYTextBox,Path=Text}" WavePlotOriginHeight="{Binding ElementName=MaxYTextBox,Path=Text,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" Background="{DynamicResource DataGrid_BG_First}" IsHorizontalDateTimeAxis="True"/>
  122. </Grid>
  123. </Grid>
  124. </UserControl>