This is a migrated thread and some comments may be shown as answers.

GridView Styling problem

2 Answers 34 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Johan
Top achievements
Rank 1
Johan asked on 06 Nov 2015, 01:29 PM

Hi, downloaded the latest version of the WPF components (2015.3.1104) a couple of days ago. When I upgraded a project to the latest version, I noticed that styles applied at the Gridview stopped working. The window is just blank and no visual grid at all.

I created a new project from scratch, converted it to Telerik application and created a resource dictionary with a simple style. (Se attached files)

Same problem. No visual grid in window. Am I doing something wrong?

 MainWindow.xaml
<telerik:RadGridView Name="testgrid" Style="{StaticResource BaseGrid}"/>

App.xaml
<Application x:Class="WpfApplication3.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:WpfApplication3" StartupUri="MainWindow.xaml">

    <Application.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Telerik.Windows.Themes.Expression_Dark;component/Themes/System.Windows.xaml" />
                <ResourceDictionary Source="/Telerik.Windows.Themes.Expression_Dark;component/Themes/Telerik.Windows.Controls.xaml" />
                <ResourceDictionary Source="/Telerik.Windows.Themes.Expression_Dark;component/Themes/Telerik.Windows.Controls.Input.xaml" />
                <ResourceDictionary Source="/Telerik.Windows.Themes.Expression_Dark;component/Themes/Telerik.Windows.Controls.GridView.xaml" />
                <ResourceDictionary Source="Styles.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Application.Resources>
</Application>

 

 Styles.xaml
    <Style x:Key="BaseGrid" TargetType="telerik:RadGridView">

        <Setter Property="GridLinesVisibility" Value="Both"/>
        <Setter Property="RowIndicatorVisibility" Value="Collapsed"/>
        <Setter Property="AutoGenerateColumns" Value="False"/>
    </Style>​

2 Answers, 1 is accepted

Sort by
0
Accepted
Stefan Nenchev
Telerik team
answered on 10 Nov 2015, 11:49 AM
Hello Johan,

Since you are using implicit styles for your project, you need to include the BasedOn property when setting the Style. For more information check the following documentation page - Basing Styles on Theme Style. Can you try the following:

<Style x:Key="BaseGrid" TargetType="telerik:RadGridView" BasedOn="{StaticResource RadGridViewStyle}">
       <Setter Property="GridLinesVisibility" Value="Both"/>
       <Setter Property="RowIndicatorVisibility" Value="Collapsed"/>
       <Setter Property="AutoGenerateColumns" Value="False"/>
</Style>​

Unfortunately, I cannot see any attached files so if the aforementioned approach does not resolve your issue, would it be possible for you to send a simple project to which I can refer?

Regards,
Stefan Nenchev
Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Johan
Top achievements
Rank 1
answered on 10 Nov 2015, 11:55 AM

Thanks, I came to the same conclusion myself after a while. Should have changed status of this simple problem.

Thanks anyway!

Tags
GridView
Asked by
Johan
Top achievements
Rank 1
Answers by
Stefan Nenchev
Telerik team
Johan
Top achievements
Rank 1
Share this question
or