标签:style color 使用 width art io
<LinearGradientBrush x:Key="VerticalScrollBarBackground" StartPoint="0,0" EndPoint="1,0">
<GradientStop Offset="0" Color="#FF484C51" />
<GradientStop Offset="0.20" Color="#FF3F4449" />
<GradientStop Offset="0.80" Color="#FF46474B" />
<GradientStop Offset="1" Color="#FF4F5255" />
</LinearGradientBrush>
<Style TargetType="DataGrid">
<Setter Property="AutoGenerateColumns" Value="False" />
<Setter Property="IsReadOnly" Value="True" />
<Setter Property="AlternationCount" Value="2" />
<Setter Property="BorderThickness" Value="0" />
<Setter Property="Background" Value="{StaticResource VerticalScrollBarBackground}" />
<Setter Property="GridLinesVisibility" Value="None" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type DataGrid}">
<ContentPresenter></ContentPresenter>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<!--标题栏样式-->
<Style TargetType="DataGridColumnHeader">
<Setter Property="BorderThickness" Value="0"></Setter>
<Setter Property="Background" Value="#828282"></Setter>
<Setter Property="Foreground" Value="#000000"></Setter>
<Setter Property="Height" Value="24"></Setter>
<Setter Property="HorizontalContentAlignment" Value="Center"></Setter>
<!--<Setter Property="FontWeight" Value="Black"></Setter>-->
<!--<Setter Property="SnapsToDevicePixels" Value="True" />-->
<!--<Setter Property="Cursor" Value="Hand" />-->
<!--<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="DataGridColumnHeader">
<Border x:Name="BackgroundBorder" BorderThickness="0,1,0,1" BorderBrush="{x:Null}" Width="Auto">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ContentPresenter VerticalAlignment="Center" HorizontalAlignment="Center"/>
<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" VerticalAlignment="Center" RenderTransformOrigin="1,1" />
<Rectangle Width="1" Fill="Gray" HorizontalAlignment="Right" Grid.ColumnSpan="1" />
</Grid>
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>-->
</Style>
<!--行样式触发-->
<!--背景色改变必须先设置cellStyle 因为cellStyle会覆盖rowStyle样式-->
<!--隔行换色-->
<Style TargetType="DataGridRow">
<Setter Property="BorderThickness" Value="0"></Setter>
<Setter Property="Height" Value="24"></Setter>
<Style.Triggers>
<Trigger Property="ItemsControl.AlternationIndex" Value="0">
<Setter Property="Background" Value="#333333"></Setter>
</Trigger>
<Trigger Property="ItemsControl.AlternationIndex" Value="1">
<Setter Property="Background" Value="#424242"></Setter>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="White"/>
</Trigger>
</Style.Triggers>
</Style>
<!--单元格样式触发-->
<!--目前使用覆盖掉默认的IsSelected-->
<Style TargetType="DataGridCell">
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="BorderThickness" Value="0"/>
</Trigger>
</Style.Triggers>
</Style>
<Style x:Key="dataGridTextColumnStyle" TargetType="{x:Type TextBlock}">
<Setter Property="HorizontalAlignment" Value="Center"></Setter>
<Setter Property="VerticalAlignment" Value="Center"></Setter>
<Setter Property="Foreground" Value="#999999"></Setter>
</Style>
<Style TargetType="{x:Type DataGridRowHeader}">
<Setter Property="Width" Value="0"></Setter>
</Style>
标签:style color 使用 width art io
原文地址:http://www.cnblogs.com/hidden/p/3852973.html