CellStyleSelector not working when I use the Telerik Themes

6 posts, 1 answers
  1. R
    R avatar
    13 posts
    Member since:
    Jun 2014

    Posted 06 Aug 2014 Link to this post

    Hi, I want to use your Office_Black theme as a base theme for my GridViews but I also need conditional cell styles to be applied. To do this I am using your CellStyleSelector. When the code executes the CellStyleSelector code is called but the styles are not being applied. I assume the Telerik theme is overriding my local styles? Is this the case and how can I fix this please? 

    Thanks a lot.

    From my User Control:

        <UserControl.Resources>
            <ResourceDictionary>
                <ResourceDictionary.MergedDictionaries>
                    <ResourceDictionary Source="../Styles/OrderStyles.xaml " />
                </ResourceDictionary.MergedDictionaries>
            </ResourceDictionary>
        </UserControl.Resources>

    From the grid xaml:

                <telerik:RadGridView.Columns >
                    <telerik:GridViewDataColumn DataMemberBinding="{Binding OrderStatus}" Header="Status" CellStyleSelector="{StaticResource OrderStatusStyleSelector}"/>

    From my app.xaml:

    <Application x:Class="My.App"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">
        <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.Navigation.xaml"/>
                    <ResourceDictionary Source="/Telerik.Windows.Themes.Expression_Dark;component/Themes/Telerik.Windows.Controls.Docking.xaml"/>
                    <ResourceDictionary Source="/Telerik.Windows.Themes.Expression_Dark;component/Themes/Telerik.Windows.Controls.Input.xaml"/>
                    <ResourceDictionary Source="/Telerik.Windows.Themes.Office_Black;component/Themes/Telerik.Windows.Controls.GridView.xaml"/>
                </ResourceDictionary.MergedDictionaries>
  2. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 06 Aug 2014 Link to this post

    Hi Russel,


    Thank you for getting back to us.

    Looking at the snippet provided I suggest that you isolated style selector styles in a custom resource dictionary OrderStyles.xaml. 

    In our online documentation, we have an article, which explains how to switch these custom styles, here.

    Will you please give it a try and let me know how it goes?


    Regards,
    Vanya Pavlova
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  3. R
    R avatar
    13 posts
    Member since:
    Jun 2014

    Posted 06 Aug 2014 Link to this post

    Thanks for the quick response Vanya. As I show above I already have the styles isolated in a separate resource dictionary. 

    I can't see how the custom styles link you provided applies to my problem.

    Can you try reproduce this as I described in my first post? So a GridView styled using the NoXaml Office_Black Theme then try to style a cell using the CellStyleSelector.

    Thanks
  4. R
    R avatar
    13 posts
    Member since:
    Jun 2014

    Posted 06 Aug 2014 Link to this post

    Update: Interestingly when i change to use the standard binaries instead of using the NoXaml binaries the CellStyleSelector works.

    Please try reproduce this - ideally I'd want to use the NoXaml version.
  5. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 10 Aug 2014 Link to this post

    Hello Russel,


    Thank you for getting back to us.

    I will prepare sample demo, that will illustrate how to integrate your style selector with custom cell styles and NoXAML binaries, later today. 



    Regards,
    Vanya Pavlova
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  6. Answer
    Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 11 Aug 2014 Link to this post

    Hello Russel,


    I'm attaching you sample demo, which illustrates how to define your own style selector using NoXAML binaries for Office_Black. 


    Regards,
    Vanya Pavlova
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top