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

RadExpander IsExpanded binding problem

1 Answer 221 Views
Expander
This is a migrated thread and some comments may be shown as answers.
J
Top achievements
Rank 1
J asked on 05 May 2018, 04:51 PM

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.

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 09 May 2018, 01:34 PM
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.
Tags
Expander
Asked by
J
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or