StyleManager that uses current theme

5 posts, 1 answers
  1. Goran
    Goran avatar
    77 posts
    Member since:
    Feb 2011

    Posted 18 May 2012 Link to this post

    I have the following requirement: I have modified styles taken from Implicit styles project, in order to achieve some custom appearance for TreeListView. When I run the application with this style, everything works fine. Next requirement is that I need to paint the background differently for each row based on some property value of item in collection.

    <RadTreeListView RowStyleSelector="{StaticResource TaskRowStyleSelector}" />
     
    <Style x:Key="PendingTreeListViewRowStyle" TargetType="telerik:TreeListViewRow">
        <Setter Property="Background" Value="#FFFFE1C4" />
    </Style>
     
    <local:PersonRowStyleSelector x:Key="TaskRowStyleSelector"
                        PendingStyle="{StaticResource PendingTreeListViewRowStyle}"
                               .../>

    And I have a TaskSelector which inherits from using System.Windows.Controls;StyleSelector. When I run the application, background is applied correctly, however I am loosing custom style that I made for RadTreeListView and RadTreeListViewItem. Next thing I tried is to add BasedOn attribute in above style, but then it doesn't paint the background (Setter Background doesn't do anything)..

    So, how can I use style selector, set a background property, while preserving the custom made style for RadTreeListView and its sub elements.
  2. Answer
    Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 22 May 2012 Link to this post

    Hi Goran,

     


    An important aspect of styles and style selectors is that if you set the respective Style or RowStyleSelector

    the StyleSelector would not be applied and it will be ignored. This means that the RowStyle combined with StyleSelector cannot work simultaneously. What you may do here is to use a single style targeted at TreeListViewRow which modifies the appearance of these rows based on your custom logic. 




    Kind regards,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. UI for WPF is Visual Studio 2017 Ready
  4. Goran
    Goran avatar
    77 posts
    Member since:
    Feb 2011

    Posted 22 May 2012 Link to this post

    Hi Vanya,

    to summarize: When I have an implicit style for RadTreeListView, and then use RowStyleSelector, the implicit style for TreeListViewRow will be overriden by the RowStyleSelector style?

    What I have also tried is to have styles that are used in RowStyleSelector inherit from my implicit TreeListViewRow style (using BasedOn), but the background property isnt applied at all? I am guessing the reason is that GridViewCell style is being applied after TreeListViewRow style.

    If I don't inherit from TreeListViewRow style, then I will have completely different look than expected.

    Regards,
    Goran
  5. Vanya Pavlova
    Admin
    Vanya Pavlova avatar
    2019 posts

    Posted 23 May 2012 Link to this post

    Hello Goran,

     

    In order to avoid any misleading would it be possible to prepare small sample demo, which illustrates your specific scenario and send it to us as an attachment in a new support ticket? 



    Regards,
    Vanya Pavlova
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  6. Goran
    Goran avatar
    77 posts
    Member since:
    Feb 2011

    Posted 24 May 2012 Link to this post

    Hi Vanya,

    after I have prepared a sample project, it worked as expected in it. Most probably there is a problem with my implicit style then, so I am going to investigate this further. Sorry for caused inconvenience.

    Goran
Back to Top
UI for WPF is Visual Studio 2017 Ready