RadTreeListView, IsSynchronizedWithCurrentItem property not working.

2 posts, 0 answers
  1. Dursun
    Dursun avatar
    3 posts
    Member since:
    Oct 2012

    Posted 07 Mar 2014 Link to this post

    Hi,

    Previously I was using RadGridView with RadDataForm.
    When IsSynchronizedWithCurrentItem property setted to True value, this controls working synchronous.

    I needed Hierarchical items on some modules and I solved this problem with RadGridView.
    But hierarchical data very complex for last user on RadGridView, that's not user-friendly.

    I decided on the RadTreeListView after that, and I solved this with hierarchical TreeListView.
    But there's a problem, IsSynchronizedWithCurrentItem setted True but RadTreeListView with RadDataForm not working synchronous.

    How can solve this problem?

    <telerik:RadTreeListView x:Name="mRadTreeListView"
                         IsReadOnly="True"
                         AutoExpandItems="True"
                         AutoGenerateColumns="False"
                         CanUserFreezeColumns="False"
                         ItemsSource="{Binding Items}"
                         IsSynchronizedWithCurrentItem="True"
                         RowIndicatorVisibility="Collapsed"
                         RowDetailsVisibilityMode="Collapsed">
        <telerik:RadTreeListView.ChildTableDefinitions>
            <telerik:TreeListViewTableDefinition ItemsSource="{Binding Children}" />
        </telerik:RadTreeListView.ChildTableDefinitions>
    </telerik:RadTreeListView>
    <telerik:RadDataForm x:Name="mRadDataForm"
                         ItemsSource="{Binding Items}"
                         VerticalAlignment="Top"
                         LabelPosition="Above"
                         AutoGenerateFields="False"
                         CommandButtonsVisibility="All"
                         AutoCommit="True">
    </telerik:RadDataForm>
  2. Vera
    Admin
    Vera avatar
    263 posts

    Posted 10 Mar 2014 Link to this post

    Hello Dursun,

    This is the expected behavior when using RadTreeListView as you depend on the CurrentItem changing of the source collection.
    Let me explain the case in details. RadTreeListView internally uses HierarchicalCollectionView that contains all items and does not notify the source collection about the current item change. RadTreeListView CurrentItem can be from either parent or child source, in your case - item from Items collection or item from Children collection. The problem comes when those collections have to be notified about TreeListView CurrentItem change. When it is an item from Children collection, what happens with the current item of the parent collection? This is why this logic is not implemented.
    What you can do is to:
    1. Listen for RadTreeListView.Items collectiion CurrentChanged event and change RadDataForm CurrentItem accordingly.
    2. Bind RadGridView CurrentItem/SelectedItem to RadDataForm CurrentItem with TwoWay mode.

    I hope this helps.

    Regards,
    Vera
    Telerik

    DevCraft Q1'14 is here! Watch the online conference to see how this release solves your top-5 .NET challenges. Watch on demand now.

  3. UI for WPF is Visual Studio 2017 Ready
Back to Top