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

RadTreeListView problem with AlternateRowBackground or AlternateRowStyle

8 Answers 151 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Pavel
Top achievements
Rank 1
Pavel asked on 09 Sep 2013, 01:09 PM
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>

8 Answers, 1 is accepted

Sort by
0
Yordanka
Telerik team
answered on 11 Sep 2013, 02:27 PM
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 >>
0
Pavel
Top achievements
Rank 1
answered on 11 Sep 2013, 03:17 PM
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?
0
Yordanka
Telerik team
answered on 12 Sep 2013, 12:56 PM
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 >>
0
Pavel
Top achievements
Rank 1
answered on 13 Sep 2013, 07:23 AM
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?
0
Yoan
Telerik team
answered on 17 Sep 2013, 05:31 PM
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 >>
0
Pavel
Top achievements
Rank 1
answered on 18 Sep 2013, 08:18 AM
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.
0
Accepted
Yoan
Telerik team
answered on 19 Sep 2013, 08:43 AM
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 >>
0
Pavel
Top achievements
Rank 1
answered on 19 Sep 2013, 09:45 AM
Hi Yoan,

Yes, it seems to be a solution of the problem. Thank you very much.
Tags
TreeListView
Asked by
Pavel
Top achievements
Rank 1
Answers by
Yordanka
Telerik team
Pavel
Top achievements
Rank 1
Yoan
Telerik team
Share this question
or