GridView Styling problem

3 posts, 1 answers
  1. Johan
    Johan avatar
    2 posts
    Member since:
    Oct 2014

    Posted 06 Nov 2015 Link to this post

    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. Answer
    Stefan Nenchev
    Admin
    Stefan Nenchev avatar
    281 posts

    Posted 10 Nov 2015 Link to this post

    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
  3. UI for WPF is Visual Studio 2017 Ready
  4. Johan
    Johan avatar
    2 posts
    Member since:
    Oct 2014

    Posted 10 Nov 2015 in reply to Stefan Nenchev Link to this post

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

    Thanks anyway!

Back to Top