telerik:RadGridView.Resources

0 Answers 100 Views
GridView
Paul
Top achievements
Rank 2
Iron
Iron
Iron
Paul asked on 20 Dec 2023, 01:09 PM

Is the a way to select a style by key from styles in app.xaml in the telerik:RadGridView.Resources section

e.g.

<telerik:RadGridView.Resources>
<!-- add xaml to select key GridViewCellType1 -->
</telerik:RadGridView.Resources>

 

<!-- style in app.xaml  -->

<Style x:Key="GridViewCellType1"
    TargetType="telerik:GridViewCell">
    <Setter Property="FontSize"
            Value="14" />
    <Setter Property="FontWeight"
            Value="Normal" />
    <Setter Property="CurrentBorderBrush"
            Value="Transparent" />
    <Setter Property="BorderBrush"
            Value="Transparent" />
</Style>

 

Martin Ivanov
Telerik team
commented on 21 Dec 2023, 01:54 PM

Can you tell me what do you mean by "select a style by key from styles in app.xaml"? Do you mean that you want to access the Style objects defined in App.xaml? If so, you can use the following syntax:

<telerik:RadGridView.Resources>
    <Style TargetType="telerik:GridViewCell" BasedOn="{StaticResource GridViewCellType1}">
         <!-- setters here -->
    </Style>
</telerik:RadGridView.Resources>

Basically, you can access any resource defined in App.xaml using the StaticResource keyword.

In case you want to use different styles for the different cells in the RadGridView control, you can use the CellStyleSelector feature of the columns.

Paul
Top achievements
Rank 2
Iron
Iron
Iron
commented on 21 Dec 2023, 02:10 PM

Yes, thank you Martin, being able to use BasedOn is the answer I was looking for.

No answers yet. Maybe you can help?

Tags
GridView
Asked by
Paul
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or