RuleList.xaml 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. <UserControl x:Class="GDNXFD.Alert.Config.Views.RuleList"
  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. mc:Ignorable="d"
  8. d:DesignHeight="666" d:DesignWidth="1024" >
  9. <Grid>
  10. <Grid.RowDefinitions>
  11. <RowDefinition Height="24px"></RowDefinition>
  12. <RowDefinition Height="*"></RowDefinition>
  13. <RowDefinition Height="50px"></RowDefinition>
  14. </Grid.RowDefinitions>
  15. <Grid Grid.Row="0" Background="#DDDDDD">
  16. <Grid.ColumnDefinitions>
  17. <ColumnDefinition Width="80"></ColumnDefinition>
  18. <ColumnDefinition Width="80"></ColumnDefinition>
  19. <ColumnDefinition Width="60"></ColumnDefinition>
  20. <ColumnDefinition Width="100"></ColumnDefinition>
  21. <ColumnDefinition Width="*"></ColumnDefinition>
  22. <ColumnDefinition Width="200"></ColumnDefinition>
  23. </Grid.ColumnDefinitions>
  24. <!--新建规则按钮-->
  25. <Button Grid.Column="0" Style="{StaticResource PrimaryColorButtonStyle}"
  26. Command="{Binding AddRuleCommand }">
  27. <Image Stretch="Uniform" Margin="0" Source="/Resources/Images/new.png" ></Image>
  28. </Button>
  29. <!--刷新按钮-->
  30. <Button Grid.Column="1" Style="{StaticResource PrimaryColorButtonStyle}"
  31. Command="{Binding RefreshRuleListCommand}">
  32. <Image Stretch="Uniform" Margin="0" Source="/Resources/Images/refresh.png"></Image>
  33. </Button>
  34. <!--规则总数-->
  35. <TextBlock Height="20" Grid.Column="2" Style="{StaticResource HugeTextPrimaryColor}" Text="{Binding RulesCount, FallbackValue=0}"></TextBlock>
  36. <TextBlock Grid.Column="3" Style="{StaticResource RightTextPrimaryColor}">
  37. <Run Text="条配置规则"></Run>
  38. </TextBlock>
  39. <!--规则列表检索条件-->
  40. <control:TextBoxKeyboard Grid.Column="5" MaxLength="50" Margin="0 0 0 0"
  41. Style="{StaticResource TextBox}"
  42. Text="{Binding Filter, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
  43. Template="{DynamicResource SearchTextBoxTemplate}">
  44. </control:TextBoxKeyboard>
  45. </Grid>
  46. <DataGrid Grid.Row="1" ItemsSource="{Binding RuleList}" CanUserAddRows="False" AutoGenerateColumns="False"
  47. VerticalGridLinesBrush="{DynamicResource {x:Static SystemColors.InactiveBorderBrushKey}}" IsReadOnly="True" >
  48. <DataGrid.HorizontalGridLinesBrush>
  49. <SolidColorBrush Color="#FFF4F7FC"/>
  50. </DataGrid.HorizontalGridLinesBrush>
  51. <DataGrid.ColumnHeaderStyle>
  52. <Style TargetType="DataGridColumnHeader">
  53. <Setter Property="HorizontalContentAlignment" Value="Center">
  54. </Setter>
  55. </Style>
  56. </DataGrid.ColumnHeaderStyle>
  57. <DataGrid.Columns>
  58. <DataGridTextColumn Header="编码" Width="120" ElementStyle="{StaticResource DataGridCellCenterStyle}"
  59. Binding="{Binding Id}" />
  60. <DataGridTextColumn Header="名称" Width="*" Binding="{Binding Name}"/>
  61. <DataGridTextColumn Header="表达式" Width="1.5*"
  62. Binding="{Binding Expression}"/>
  63. <DataGridTextColumn Header="级别" Width="60" ElementStyle="{StaticResource DataGridCellCenterStyle}"
  64. Binding="{Binding Rank, Converter={StaticResource RankCodeToTextConverter}}" />
  65. <DataGridTextColumn Header="类型" Width="60" ElementStyle="{StaticResource DataGridCellCenterStyle}"
  66. Binding="{Binding Category, Converter={StaticResource CategoryCodeToTextConverter}}"/>
  67. <DataGridTextColumn Header="描述" Width="*"
  68. Binding="{Binding Description}"/>
  69. <DataGridTextColumn Header="标签" Width="50" Visibility="Hidden"
  70. Binding="{Binding Tag}"/>
  71. <DataGridCheckBoxColumn Header="状态" Width="60" IsReadOnly="True"
  72. Binding="{Binding Enabled}"/>
  73. <!--<DataGridTextColumn Header="范围" Width="*"
  74. Binding="{Binding Range}"/>-->
  75. <DataGridTemplateColumn Header="操作" Width="80">
  76. <DataGridTemplateColumn.CellTemplate>
  77. <DataTemplate>
  78. <StackPanel Orientation="Horizontal">
  79. <Button CommandParameter="{Binding}" Margin="0,0,5,0"
  80. ToolTip="{Binding Edit, Source={StaticResource Provider}, Mode=OneWay}"
  81. Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}, Path=DataContext.EditRuleCommand }"
  82. Style="{StaticResource TransparentButtonStyle}">
  83. <Button.Content>
  84. <Image Source="/Resources/Images/edit.png" Width="21" Height="21"></Image>
  85. </Button.Content>
  86. </Button>
  87. <Button CommandParameter="{Binding}"
  88. Style="{StaticResource TransparentButtonStyle}" Margin="0,0,5,0"
  89. ToolTip="查看"
  90. Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}, Path=DataContext.ViewRuleCommand}">
  91. <Button.Content>
  92. <Image Source="/Resources/Images/view.png" Width="20" Height="16"></Image>
  93. </Button.Content>
  94. </Button>
  95. <Button CommandParameter="{Binding Id}"
  96. Style="{StaticResource TransparentButtonStyle}"
  97. ToolTip="{Binding Remove, Source={StaticResource Provider}, Mode=OneWay}"
  98. Command="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=UserControl}, Path=DataContext.RemoveRuleCommand}">
  99. <Button.Content>
  100. <Image Source="/Resources/Images/delete.png" Width="18" Height="18"></Image>
  101. </Button.Content>
  102. </Button>
  103. </StackPanel>
  104. </DataTemplate>
  105. </DataGridTemplateColumn.CellTemplate>
  106. </DataGridTemplateColumn>
  107. </DataGrid.Columns>
  108. </DataGrid>
  109. <!--规则列表-->
  110. <!--<ItemsControl Grid.Row="2" ItemsSource="{Binding RuleList}" ItemTemplate="{StaticResource ListRulesTemplate}" Focusable="False"
  111. HorizontalContentAlignment="Stretch">
  112. </ItemsControl>-->
  113. <!--列表分页及按钮-->
  114. <StackPanel Grid.Row="2" Orientation="Horizontal" HorizontalAlignment="Right">
  115. <Button Style="{StaticResource PreviousPageButtonStyle}" ToolTip="{Binding PreviousPage, Source={StaticResource Provider}, Mode=OneWay}"
  116. Command="{Binding PreviousPageCommand}"/>
  117. <ItemsControl Grid.Row="2" ItemsSource="{Binding PagesList}" Background="{StaticResource second-background-color-brush}"
  118. ItemTemplate="{StaticResource ListPagesTemplate}" ItemsPanel="{StaticResource HorizontalItemsPanel}"
  119. Padding="0,0,0,0" >
  120. </ItemsControl>
  121. <Button Grid.Row="2" Style="{StaticResource NextPageButtonStyle}" ToolTip="{Binding NextPage, Source={StaticResource Provider}, Mode=OneWay}"
  122. Command="{Binding NextPageCommand}"/>
  123. </StackPanel>
  124. </Grid>
  125. </UserControl>