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

RadTreeListView and RowDetails

2 Answers 173 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
Jerome
Top achievements
Rank 1
Jerome asked on 14 Aug 2014, 09:21 AM
Hi,

I want to show a RowDetails on a RadTreeListView but only when a row is selected AND only on spesifics rows.

So i try to bind the DetailsVisibility like this:

<telerik:RadTreeListView.RowStyle>
<Style TargetType="telerik:TreeListViewRow">
<Setter Property="DetailsVisibility">
<Setter.Value>
                            <MultiBinding Converter="{StaticResource ParameterStepSynchronizeRowDetailsVisibilityConverter}">
                                <Binding Path="HasDetails"></Binding>
                                <Binding Path="GridSelected"></Binding>
                            </MultiBinding>
                        </Setter.Value>
                    </Setter>
<Setter Property="IsSelected" Value="{Binding GridSelected, Mode=OneWayToSource}"></Setter>
</Style>
</telerik:RadTreeListView.RowStyle>

It works fine but when i scroll down until can't see this item and them i go top, i don't know why but when my selection change my converter is never call again.

How can i perform this?

Thank you in advance

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitrina
Telerik team
answered on 15 Aug 2014, 10:45 AM
Hello,

Generally, working with the visual elements would not be a recommended approach. Since RadTreeListView supports UI Virtualization, its rows/cells are reused, which means that on scrolling each row is loaded and unloaded. You can check our online documentation on UI Virtualization for a further reference. In your case the TreeListViewRows are recycled as you scroll up and down and this should be the reason why the converter stops being called. You can do a simple test - set EnableRowVirtualization="False" and test again.

I can suggest you an alternative solution. In order to be able to expand row details on row selection, you should configure RadGridView with RowDetailsVisibilityMode="VisibleWhenSelected". You can also refer to the Row Details Visibility article.

Then, you can subscribe for the RowDetailsVisibilityChanging event and apply some additional logic.
For example:
private void GridView_RowDetailsVisibilityChanging(object sender, Telerik.Windows.Controls.GridView.RowDetailsVisibilityChangingEventArgs e)
{
    if (e.NewVisibility == Visibility.Visible && !(e.Row.Item as Club).HasHierarchy)
    {
        e.Cancel = true;
    }
}

Let me know how this works for you.

Regards,
Didie
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.
 
0
Jerome
Top achievements
Rank 1
answered on 18 Aug 2014, 08:11 AM
Your solution works fine, thank you very much!
Tags
TreeListView
Asked by
Jerome
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Jerome
Top achievements
Rank 1
Share this question
or