RadTreeListView and RowDetails

3 posts, 1 answers
  1. Jerome
    Jerome avatar
    2 posts
    Member since:
    Aug 2014

    Posted 14 Aug 2014 Link to this post


    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:

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

    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. Answer
    Dimitrina avatar
    3769 posts

    Posted 15 Aug 2014 Link to this post


    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.

    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. Jerome
    Jerome avatar
    2 posts
    Member since:
    Aug 2014

    Posted 18 Aug 2014 in reply to Dimitrina Link to this post

    Your solution works fine, thank you very much!
Back to Top