App.xaml 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <Application x:Class="AGV_WPF.App"
  2. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  3. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4. StartupUri="Login.xaml">
  5. <Application.Resources>
  6. <!-- 表格样式设置 -->
  7. <Style TargetType="DataGrid">
  8. <!--网格线颜色-->
  9. <Setter Property="CanUserResizeColumns" Value="false"/>
  10. <Setter Property="Background" Value="#E6DBBB" />
  11. <Setter Property="BorderBrush" Value="#d6c79b" />
  12. <Setter Property="HorizontalGridLinesBrush">
  13. <Setter.Value>
  14. <SolidColorBrush Color="#d6c79b"/>
  15. </Setter.Value>
  16. </Setter>
  17. <Setter Property="VerticalGridLinesBrush">
  18. <Setter.Value>
  19. <SolidColorBrush Color="#d6c79b"/>
  20. </Setter.Value>
  21. </Setter>
  22. </Style>
  23. <Style TargetType="DataGridColumnHeader">
  24. <Setter Property="Template">
  25. <Setter.Value>
  26. <ControlTemplate TargetType="DataGridColumnHeader">
  27. <Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1"
  28. BorderBrush="#e6dbba"
  29. Width="Auto">
  30. <Grid >
  31. <Grid.ColumnDefinitions>
  32. <ColumnDefinition Width="*" />
  33. </Grid.ColumnDefinitions>
  34. <ContentPresenter Margin="0,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Center"/>
  35. <Path x:Name="SortArrow" Visibility="Collapsed" Data="M0,0 L1,0 0.5,1 z" Stretch="Fill" Grid.Column="2" Width="8" Height="6" Fill="White" Margin="0,0,50,0"
  36. VerticalAlignment="Center" RenderTransformOrigin="1,1" />
  37. <Rectangle Width="1" Fill="#d6c79b" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
  38. </Grid>
  39. </Border>
  40. </ControlTemplate>
  41. </Setter.Value>
  42. </Setter>
  43. </Style>
  44. <!--行样式触发-->
  45. <Style TargetType="DataGridRow">
  46. <Setter Property="Background" Value="#F2F2F2" />
  47. <Setter Property="Height" Value="25"/>
  48. <Setter Property="Foreground" Value="Black" />
  49. <Style.Triggers>
  50. <!--隔行换色-->
  51. <Trigger Property="AlternationIndex" Value="0" >
  52. <Setter Property="Background" Value="#e7e7e7" />
  53. </Trigger>
  54. <Trigger Property="AlternationIndex" Value="1" >
  55. <Setter Property="Background" Value="#f2f2f2" />
  56. </Trigger>
  57. <Trigger Property="IsMouseOver" Value="True">
  58. <Setter Property="Background" Value="LightGray"/>
  59. </Trigger>
  60. <Trigger Property="IsSelected" Value="True">
  61. <Setter Property="Foreground" Value="Black"/>
  62. <Setter Property="Background" Value="DarkGray"/>
  63. </Trigger>
  64. </Style.Triggers>
  65. </Style>
  66. <!--单元格样式触发-->
  67. <Style TargetType="DataGridCell">
  68. <Setter Property="Template">
  69. <Setter.Value>
  70. <ControlTemplate TargetType="DataGridCell">
  71. <TextBlock TextAlignment="Center" VerticalAlignment="Center">
  72. <TextBlock.Triggers>
  73. </TextBlock.Triggers>
  74. <ContentPresenter />
  75. </TextBlock>
  76. </ControlTemplate>
  77. </Setter.Value>
  78. </Setter>
  79. <Style.Triggers>
  80. <Trigger Property="IsSelected" Value="True">
  81. <Setter Property="Foreground" Value="Black"/>
  82. </Trigger>
  83. </Style.Triggers>
  84. </Style>
  85. <CollectionViewSource x:Key="sysFonts" Source="{x:Static Fonts.SystemFontFamilies}" />
  86. </Application.Resources>
  87. </Application>