1

我有一个使用 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>
4

2 回答 2

2

试试这个代码:

<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>

希望这对您有所帮助。

于 2013-07-02T04:40:53.390 回答
0

您需要做的就是将“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>
于 2013-07-02T16:36:22.380 回答