将telerik:RadGridView的默认颜色从黑色更改为蓝色
本文关键字:黑色 蓝色 颜色 telerik RadGridView 默认 | 更新日期: 2023-09-27 18:20:48
我有一个使用telerik的RadGridView,默认颜色是黑色。我在想我该如何改变这种颜色。
<telerik:RadGridView Name="dgData1"
ScrollViewer.VerticalScrollBarVisibility="Hidden" ScrollViewer.HorizontalScrollBarVisibility="Visible" VerticalAlignment="Bottom"
AutoGenerateColumns="False" Grid.Column="0"
ShowGroupPanel="False"
IsFilteringAllowed="False"
CanUserReorderColumns="False"
RowIndicatorVisibility ="Collapsed"
IsReadOnly="True"
EnableRowVirtualization="False"
EnableColumnVirtualization="False"
SelectionMode="Single"
Sorting="dgData_Sorting">
</telerik:RadGridView>
试试这个代码:
<telerik:RadGridView ItemsSource="{Binding}" Background="Red" Foreground="White" AutoGenerateColumns="False" HorizontalAlignment="Left" Margin="24,36,0,0" Name="radGridView1" VerticalAlignment="Top">
<telerik:RadGridView.RowStyle>
<Style TargetType="{x:Type telerik:GridViewRow}">
<Setter Property="Background" Value="Red"/>
<Setter Property="Foreground" Value="White"/>
<Style.Triggers>
<Trigger Property="IsSelected" Value="True">
<Setter Property="Background" Value="DarkOrange"/>
<Setter Property="Foreground" Value="black"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="Background" Value="LightYellow"/>
<Setter Property="Foreground" Value="black"/>
</Trigger>
</Style.Triggers>
</Style>
</telerik:RadGridView.RowStyle>
<telerik:RadGridView.Columns>
<telerik:GridViewDataColumn Header="EmployeeID" DataMemberBinding="{Binding EmployeeID}"/>
</telerik:RadGridView.Columns>
</telerik:RadGridView>
希望这对你有所帮助。
您所需要做的就是将"telerik:StyleManager.Theme="Summer"添加到您的数据网格视图中。
<telerik:RadGridView Name="someName" telerik:StyleManager.Theme="Summer"
AutoGenerateColumns="False" Grid.Column="0"
ShowGroupPanel="False"
IsFilteringAllowed="False"
CanUserReorderColumns="False"
RowIndicatorVisibility ="Collapsed"
IsReadOnly="True"
EnableRowVirtualization="False"
EnableColumnVirtualization="False"
SelectionMode="Single"
</telerik:RadGridView>