DIList.xaml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249
  1. <UserControl x:Class="GDNXFD.Alert.Config.Views.DIList"
  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:control="clr-namespace:GDNXFD.Alert.Config.Controls"
  7. xmlns:converts="clr-namespace:GDNXFD.Alert.Config.Converters"
  8. mc:Ignorable="d"
  9. d:DesignHeight="666" d:DesignWidth="1024" >
  10. <UserControl.Resources>
  11. <converts:LevelIdToTextConverter x:Key="levelConverter" />
  12. <converts:StationIdToTextConverter x:Key="stationConverter" />
  13. <converts:Category2ToTextConverter x:Key="categoryConverter" />
  14. <CollectionViewSource x:Key="statusViewSource" />
  15. <CollectionViewSource x:Key="rankViewSource" />
  16. <CollectionViewSource x:Key="stationViewSource" />
  17. <!-- 分页样式 -->
  18. <Style x:Key="PageButtonStyle" TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
  19. <Setter Property="Template">
  20. <Setter.Value>
  21. <ControlTemplate TargetType="{x:Type Button}">
  22. <Border x:Name="bdr_main" Background="Transparent">
  23. <ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center" ContentSource="Content" />
  24. </Border>
  25. <ControlTemplate.Triggers>
  26. <Trigger Property="IsMouseOver" Value="True">
  27. <Setter Property="FontSize" Value="15"/>
  28. </Trigger>
  29. </ControlTemplate.Triggers>
  30. </ControlTemplate>
  31. </Setter.Value>
  32. </Setter>
  33. <Setter Property="Width" Value="30"/>
  34. <Setter Property="FontSize" Value="15"/>
  35. <Setter Property="FontWeight" Value="Bold"/>
  36. <Setter Property="Foreground" Value="Black"/>
  37. </Style>
  38. <Style x:Key="NextPageButtonStyle" TargetType="Button" BasedOn="{StaticResource PageButtonStyle}">
  39. <Setter Property="Content" Value="&gt;"/>
  40. </Style>
  41. <Style x:Key="PreviousPageButtonStyle" TargetType="Button" BasedOn="{StaticResource PageButtonStyle}">
  42. <Setter Property="Content" Value="&lt;"/>
  43. </Style>
  44. <Style x:Key="FirstPageButtonStyle" TargetType="Button" BasedOn="{StaticResource PageButtonStyle}">
  45. <Setter Property="Content" Value="|&lt;"/>
  46. <Setter Property="Width" Value="25"/>
  47. </Style>
  48. <Style x:Key="LastPageButtonStyle" TargetType="Button" BasedOn="{StaticResource PageButtonStyle}">
  49. <Setter Property="Content" Value="&gt;|"/>
  50. <Setter Property="Width" Value="25"/>
  51. </Style>
  52. </UserControl.Resources>
  53. <Grid>
  54. <Grid.RowDefinitions>
  55. <RowDefinition Height="24px"></RowDefinition>
  56. <RowDefinition Height="*"></RowDefinition>
  57. <RowDefinition Height="50px"></RowDefinition>
  58. </Grid.RowDefinitions>
  59. <Grid Grid.Row="0" Background="#DDDDDD">
  60. <StackPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" >
  61. <TextBlock Text="场站:" Margin="15 5 0 0" />
  62. <ComboBox x:Name="cmbStation" VerticalAlignment="Center" Margin="0,0,0,0"
  63. Width="130" Background="White"
  64. SelectionChanged="cmbStation_SelectionChanged">
  65. <ComboBoxItem Tag="MHS_FDC">麻黄山风电场</ComboBoxItem>
  66. <ComboBoxItem Tag="NSS_FDC">牛首山风电场</ComboBoxItem>
  67. <ComboBoxItem Tag="QS_FDC">青山风电场</ComboBoxItem>
  68. <ComboBoxItem Tag="SBQ_FDC">石板泉风电场</ComboBoxItem>
  69. <ComboBoxItem Tag="XS_FDC">香山风电场</ComboBoxItem>
  70. <ComboBoxItem Tag="DWK_GDC">大武口光伏电站</ComboBoxItem>
  71. <ComboBoxItem Tag="PL_GDC">平罗光伏电站</ComboBoxItem>
  72. <ComboBoxItem Tag="MCH_GDC">马场湖光伏电站</ComboBoxItem>
  73. <ComboBoxItem Tag="XH_GDC">宣和光伏电站</ComboBoxItem>
  74. <ComboBoxItem Selector.IsSelected="True" x:Name="stationAllItem" >全部</ComboBoxItem>
  75. </ComboBox>
  76. <TextBlock Text="级别:" Margin="15 5 0 0" />
  77. <ComboBox x:Name="cmbRank" VerticalAlignment="Center" Margin="0,0,0,0"
  78. Width="80" SelectionChanged="cmbRank_SelectionChanged">
  79. <ComboBoxItem Tag="LOLO">低</ComboBoxItem>
  80. <ComboBoxItem Tag="LO">中低</ComboBoxItem>
  81. <ComboBoxItem Tag="MEDIUM">中</ComboBoxItem>
  82. <ComboBoxItem Tag="HI">中高</ComboBoxItem>
  83. <ComboBoxItem Tag="HIHI">高</ComboBoxItem>
  84. <ComboBoxItem Selector.IsSelected="True" x:Name="rankAllItem" >全部</ComboBoxItem>
  85. </ComboBox>
  86. <TextBlock Text="类型:" Margin="15 5 0 0" />
  87. <ComboBox x:Name="cmbCategory" VerticalAlignment="Center" Margin="0,0,0,0"
  88. Width="80" SelectionChanged="cmbCategory_SelectionChanged" >
  89. <ComboBoxItem Tag="GF">光伏</ComboBoxItem>
  90. <ComboBoxItem Tag="SYZ">升压站</ComboBoxItem>
  91. <ComboBoxItem Selector.IsSelected="True" x:Name="category1AllItem" Tag="" >全部</ComboBoxItem>
  92. </ComboBox>
  93. <TextBlock Text="状态:" Margin="15 5 0 0" />
  94. <ComboBox x:Name="cmbConfirmStatus" VerticalAlignment="Center" Margin="0,0,0,0"
  95. Width="80" SelectionChanged="cmbConfirmStatus_SelectionChanged" >
  96. <ComboBoxItem Selector.IsSelected="True" x:Name="statusAllItem" >全部</ComboBoxItem>
  97. <ComboBoxItem Tag="0" x:Name="itemUnconfirmed">未启用</ComboBoxItem>
  98. <ComboBoxItem Tag="1">启用</ComboBoxItem>
  99. </ComboBox>
  100. <TextBlock Text="关键字:" Margin="15 5 0 0" />
  101. <control:TextBoxKeyboard Grid.Column="5" MaxLength="50" Margin="0 0 0 0"
  102. Style="{StaticResource TextBox}"
  103. x:Name="txtFilter" Text="" Width="160"
  104. TextChanged="txtFilter_TextChanged">
  105. </control:TextBoxKeyboard>
  106. <!--刷新按钮-->
  107. <Button Style="{StaticResource PrimaryColorButtonStyle}" Margin="15 0 0 0"
  108. x:Name="btnRefresh" Click="btnRefresh_Click">
  109. <Image Stretch="Uniform" Margin="0" Source="/Resources/Images/query.png"></Image>
  110. </Button>
  111. <Button Style="{StaticResource PrimaryColorButtonStyle}" Margin="5 0 0 0"
  112. x:Name="btnNew" Click="btnNew_Click">
  113. <Image Stretch="Uniform" Margin="0" Source="/Resources/Images/new.png" ></Image>
  114. </Button>
  115. </StackPanel>
  116. </Grid>
  117. <DataGrid Grid.Row="1" x:Name="dgDIList"
  118. CanUserAddRows="False" AutoGenerateColumns="False"
  119. RowDetailsVisibilityMode="VisibleWhenSelected"
  120. SelectionMode="Extended" SelectionUnit="Cell"
  121. SelectedCellsChanged="dgDIList_SelectedCellsChanged"
  122. RowEditEnding="dgDIList_RowEditEnding"
  123. VerticalGridLinesBrush="{DynamicResource {x:Static SystemColors.InactiveBorderBrushKey}}" >
  124. <DataGrid.HorizontalGridLinesBrush>
  125. <SolidColorBrush Color="#FFF4F7FC"/>
  126. </DataGrid.HorizontalGridLinesBrush>
  127. <DataGrid.ColumnHeaderStyle>
  128. <Style TargetType="DataGridColumnHeader">
  129. <Setter Property="HorizontalContentAlignment" Value="Center">
  130. </Setter>
  131. </Style>
  132. </DataGrid.ColumnHeaderStyle>
  133. <DataGrid.Columns>
  134. <DataGridTemplateColumn Header="场站" Width="*" >
  135. <DataGridTemplateColumn.CellTemplate>
  136. <DataTemplate>
  137. <TextBlock Text="{Binding Path=StationName, UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Center" VerticalAlignment="Center" />
  138. </DataTemplate>
  139. </DataGridTemplateColumn.CellTemplate>
  140. <DataGridTemplateColumn.CellEditingTemplate>
  141. <DataTemplate>
  142. <Grid FocusManager.FocusedElement="{Binding ElementName= stationCombo}" >
  143. <ComboBox x:Name="stationCombo" HorizontalAlignment="Center" VerticalAlignment="Center"
  144. ItemsSource="{Binding Source={StaticResource stationViewSource}}"
  145. SelectedItem ="{Binding Path=StationName,UpdateSourceTrigger=PropertyChanged}" IsSynchronizedWithCurrentItem="False"/>
  146. </Grid>
  147. </DataTemplate>
  148. </DataGridTemplateColumn.CellEditingTemplate>
  149. </DataGridTemplateColumn>
  150. <DataGridTextColumn Header="测点名称" Width="*" Binding="{Binding PointKey}"
  151. IsReadOnly="True"
  152. ElementStyle="{StaticResource DataGridCellCenterStyle}" />
  153. <DataGridTextColumn Header="测点描述" Width="3*"
  154. ElementStyle="{StaticResource DataGridCellCenterStyle}"
  155. Binding="{Binding Description,UpdateSourceTrigger=PropertyChanged}"/>
  156. <DataGridTemplateColumn Header="级别" Width="100" >
  157. <DataGridTemplateColumn.CellTemplate>
  158. <DataTemplate>
  159. <TextBlock Text="{Binding Path=Rank, UpdateSourceTrigger=PropertyChanged}" />
  160. </DataTemplate>
  161. </DataGridTemplateColumn.CellTemplate>
  162. <DataGridTemplateColumn.CellEditingTemplate>
  163. <DataTemplate>
  164. <Grid FocusManager.FocusedElement="{Binding ElementName= rankCombo}" >
  165. <ComboBox x:Name="rankCombo"
  166. ItemsSource="{Binding Source={StaticResource rankViewSource}}"
  167. SelectedItem ="{Binding Path=Rank,UpdateSourceTrigger=PropertyChanged}" IsSynchronizedWithCurrentItem="False"/>
  168. </Grid>
  169. </DataTemplate>
  170. </DataGridTemplateColumn.CellEditingTemplate>
  171. </DataGridTemplateColumn>
  172. <DataGridTemplateColumn x:Name="taskColumnFaster" Header="类型" Width="100" >
  173. <DataGridTemplateColumn.CellTemplate>
  174. <DataTemplate>
  175. <TextBlock Text="{Binding Path=Category, UpdateSourceTrigger=PropertyChanged}" />
  176. </DataTemplate>
  177. </DataGridTemplateColumn.CellTemplate>
  178. <DataGridTemplateColumn.CellEditingTemplate>
  179. <DataTemplate>
  180. <Grid FocusManager.FocusedElement="{Binding ElementName= taskCombo}" >
  181. <ComboBox x:Name="taskCombo"
  182. ItemsSource="{Binding Source={StaticResource statusViewSource}}"
  183. SelectedItem ="{Binding Path=Category,UpdateSourceTrigger=PropertyChanged}" IsSynchronizedWithCurrentItem="False"/>
  184. </Grid>
  185. </DataTemplate>
  186. </DataGridTemplateColumn.CellEditingTemplate>
  187. </DataGridTemplateColumn>
  188. <DataGridCheckBoxColumn Header="状态" Width="80" IsReadOnly="True"
  189. ElementStyle="{StaticResource CheckBoxCellCenterStyle}"
  190. Binding="{Binding Enabled, UpdateSourceTrigger=PropertyChanged}">
  191. <DataGridCheckBoxColumn.CellStyle>
  192. <Style>
  193. <EventSetter Event="CheckBox.Checked" Handler="chkChanged" />
  194. <EventSetter Event="CheckBox.Unchecked" Handler="chkChanged" />
  195. </Style>
  196. </DataGridCheckBoxColumn.CellStyle>
  197. </DataGridCheckBoxColumn>
  198. </DataGrid.Columns>
  199. </DataGrid>
  200. <!--分页-->
  201. <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Grid.Row="2" >
  202. <Button Style="{StaticResource FirstPageButtonStyle}" ToolTip="首页"
  203. Click="FirstPage_Click" />
  204. <Button Style="{StaticResource PreviousPageButtonStyle}" ToolTip="上一页"
  205. Click="PrePage_Click" />
  206. <ItemsControl x:Name="icPages" Background="#FFDFE0E0"
  207. ItemTemplate="{StaticResource ListPagesTemplate}"
  208. ItemsPanel="{StaticResource HorizontalItemsPanel}"
  209. Padding="0,0,0,0" >
  210. </ItemsControl>
  211. <Button Grid.Row="2" Style="{StaticResource NextPageButtonStyle}" ToolTip="下一页"
  212. Click="NextPage_Click"/>
  213. <Button Style="{StaticResource LastPageButtonStyle}" ToolTip="尾页"
  214. Click="LastPage_Click" />
  215. </StackPanel>
  216. </Grid>
  217. </UserControl>