RadTreeListView problem with AlternateRowBackground or AlternateRowStyle

9 posts, 1 answers
  1. Pavel
    Pavel avatar
    7 posts
    Member since:
    May 2012

    Posted 09 Sep 2013 Link to this post

    Hello,

    I have a problem with setting AlternateRowBackground or AlternateRowStyle for RadTreeListView. It occures only when vertical scroll bar is visible.

    When I put hierarchical data into RadTreeListView and begin to expand and collapse parent rows alternation coloring becomes broken. So I get a pair of rows with the same color instead of iterating.

    There's a screenshot of the result in the attach.

    The code is very simple:      
    <telerik:RadTreeListView ItemsSource="{Binding Path=TestData}"
                             AlternationCount="2"
                             AlternateRowBackground="DarkGray">
        <telerik:RadTreeListView.ChildTableDefinitions>
            <telerik:TreeListViewTableDefinition ItemsSource="{Binding Path=Children}" />
        </telerik:RadTreeListView.ChildTableDefinitions>
    </telerik:RadTreeListView>
  2. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 11 Sep 2013 Link to this post

    Hi Pavel,

    Thank you for the feedback.

    Could you test your project with Q2 2013 SP1 binaries? Let me know about the result.
     
    Regards,
    Yordanka
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
  4. Pavel
    Pavel avatar
    7 posts
    Member since:
    May 2012

    Posted 11 Sep 2013 Link to this post

    Hi Yordanka,

    I've tested this with the latest binaries and it seems it works fine. The screenshoot from the first post was taken with binaries Q1 2013 SP1.

    But I still have a question about behavior of AlternateBackground (or Style) property.

    Scenario is the following:
    * I have a two-level hierarchy of objects of one type. Lets say Parents and Children.
    * I have to display them in the RadTreeListView
    * I have to display children only in LightGray color
    * I have to display Parents using AlternateBackground property so that odd will be colored in White and even - in DarkGray.

    It seems that Alternate row number counting throug all rows, including children. And I've got realy bad picture attached.
    As you can see there're Parent 4, 5 and 6 are Gray, but Parent 5 must be in White color. And the worse thing is that they change their color as I collapse or expand parent rows.

    How this can be solved?
  5. Yordanka
    Admin
    Yordanka avatar
    634 posts

    Posted 12 Sep 2013 Link to this post

    Hi Pavel,

    Indeed, when you use alternation it will be applied to all items, no matter they are parent or child. In order to alternate only parent items you could use AlternateRowStyleSelection. The same demo is available for wpf as well and is applicable for RadTreeListView. 
     
    Regards,
    Yordanka
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  6. Pavel
    Pavel avatar
    7 posts
    Member since:
    May 2012

    Posted 13 Sep 2013 Link to this post

    Hi Yordanka,

    Thanks for clarification.

    But, as I understood AlternateRowStyleSelector will be applied only to Alternate rows, no matter they are parent or child? If so, this selector still will be applied not to all parent rows because their alternation state depends on their collapsed or expanded state. So I will still have a problem with thanging alternation state for parent rows. Am I right?
  7. Yoan
    Admin
    Yoan avatar
    1070 posts

    Posted 17 Sep 2013 Link to this post

    Hi Pavel,

    Actually, you can check if the TreeListRow is parent or child using its IndentLevel property. I have prepared a sample project showing you the approach. Please take a look at it and let me know how it works for you.

    Regards,
    Yoan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  8. Pavel
    Pavel avatar
    7 posts
    Member since:
    May 2012

    Posted 18 Sep 2013 Link to this post

    Hi Yoan,

    This is nice axample, but it doesn't solve my problem.

    In your app there're just different alternate styles for parent and child rows. But in my case I have to implement 'stable' alternation only for parent rows and color all children rows in gray. 'Stable' means that alternation does'n change if user collapse or expand parents.

    As you can see in screenshot from the post above I have to make row "Parent 5" to be white whether row "Parent 4" collapsed or expanded.
  9. Answer
    Yoan
    Admin
    Yoan avatar
    1070 posts

    Posted 19 Sep 2013 Link to this post

    Hi Pavel,

    Thank you for the clarification.

    Generally, you can simulate rows alternation with the RowStyleSelector. In this case you will not have to deal with the TreeListView's native alternation. I have modified the sample project from my previous reply. 

    I believe that is what you are looking for.

    Regards,
    Yoan
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  10. Pavel
    Pavel avatar
    7 posts
    Member since:
    May 2012

    Posted 19 Sep 2013 Link to this post

    Hi Yoan,

    Yes, it seems to be a solution of the problem. Thank you very much.
Back to Top
UI for WPF is Visual Studio 2017 Ready