RadExpander IsExpanded binding problem

2 posts, 0 answers
  1. J
    J avatar
    27 posts
    Member since:
    Aug 2016

    Posted 05 May 2018 Link to this post

    I have an expander that contains sub-expanders. I want to automatically close the sub-expanders when I close the main expander. I have implemented this logic using data binding, but it doesn't seem to work correctly.

    Looks like binding to the IsExpanded property gets destroyed after you close the expander using the expander's button. Have omitted a call to the SetCurrentValue method...?

    Example project attached. See the ReadMe.txt for details.

    Pretty frustrating that you don't allow attaching archives. Doesn't encourage that much creating example projects. Your ticket system is a pain in the donkey if you are a consultant. Things could be done more easily and efficiently.

    Anyways, here's a Google Drive link to download the project: https://drive.google.com/drive/folders/1JvBukVvfmxWsRW5Wb-nRXbT5a6EOWvCd

    Let me know when you have downloaded it so I can delete the file.

  2. Martin Ivanov
    Admin
    Martin Ivanov avatar
    2223 posts

    Posted 09 May 2018 Link to this post

    Hello J,

    I downloaded the project, so you can delete it from the storage. Kudos for the good steps to reproduce the issue.

    Setting the value of the SubMenuIsExpanded property doesn't work because of the binding mode set for the IsExpanded property binding. Basically, the IsExpanded property of the RadExpander control is bound with TwoWay mode in its ControlTemplate to the IsChecked property of the internal toggle button that handles the UI expand/collapse interaction. This is similar to setting a local value to the property which has a bigger priority than a binding with Mode=OneWay. 

    In order to resolve this you can set the Mode of the binding to the SubMenuIsExpandedProperty to TwoWay.
    <telerik:RadExpander IsExpanded="{Binding SubMenuIsExpanded, Mode=TwoWay}">
    I hope that helps.

    As a side note, the indeed the forum doesn't allow .zip attachments. Instead you can use the ticketing system to open a new support ticket.

    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