IsExpanded overrides binding on initialization

5 posts, 0 answers
  1. Brian
    Brian avatar
    1 posts
    Member since:
    Dec 2013

    Posted 12 Dec 2013 Link to this post

    I have databound RadTreeViewItem.IsExpanded in my item container style, but when the item is created, it ignores the binding (which is set to true) and sets the property to false.  I found another thread in the forum describing the same behavior happening with the IsChecked property.

    Call stack:

      Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.RadTreeViewItem.IsExpanded.set(bool value) Line 390 C#
    > Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.RadTreeViewItem.OnIsExpandedChanged(bool oldValue, bool newValue) Line 1186 C#
      Telerik.Windows.Controls.Navigation.dll!Telerik.Windows.Controls.RadTreeView.RestoreContainerProperties(object item, Telerik.Windows.Controls.RadTreeViewItem treeViewItem) Line 678 C#

  2. Pavel R. Pavlov
    Admin
    Pavel R. Pavlov avatar
    1240 posts

    Posted 17 Dec 2013 Link to this post

    Hello Brian,

    I tried to reproduce the reported behavior on our side with our latest official release and it seems that the code works as expected. Could you please take a look at the attached project and let us know if there is something that I missed? It will be great if you can change the code so that the issue can be reproduced on our side and send it over. By doing this we will be able to further investigate the possible reasons behind.

    Regards,
    Pavel R. Pavlov
    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. Shilo
    Shilo avatar
    2 posts
    Member since:
    Jul 2012

    Posted 26 Nov 2017 in reply to Pavel R. Pavlov Link to this post

    Hi Brian,

    I have the same problem.

    The Binding continues until I manually expand or collapse the node.
    At that moment, the Binding is stopped.

    The problem also exists in the example you sent.

    I demonstrated the problem in the video. See attached link.

    https://www.dropbox.com/s/4gyh9f63399gbem/ScreenCapture_26-11-2017%2011.21.50.wmv?dl=0

    Shilo

      

  4. Shilo
    Shilo avatar
    2 posts
    Member since:
    Jul 2012

    Posted 26 Nov 2017 in reply to Pavel R. Pavlov Link to this post

    Hi Pavel,
    The last comment I wrote was for you (not for Brian)
    Shilo
  5. Martin Ivanov
    Admin
    Martin Ivanov avatar
    1590 posts

    Posted 29 Nov 2017 Link to this post

    Hello Brian,

    To update the property of the model (DataItem) when you expand/collapse a node manually you can set the Mode of the binding to TwoWay.
    <Style TargetType="telerik:RadTreeViewItem" x:Key="MyStyle">
        <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
    </Style>

    Regards,
    Martin Ivanov
    Progress Telerik
    Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Back to Top