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

Binding to IsChecked property of checkbox

1 Answer 123 Views
Expander
This is a migrated thread and some comments may be shown as answers.
Deepak Shakya
Top achievements
Rank 1
Deepak Shakya asked on 18 Oct 2011, 07:11 AM
Hi,

  • I have bound the IsExpanded property of the expander to the IsChecked property of the checkbox usign Element property binding in Blend.
  • When it starts, it works fine. i.e. when I check the box, it expands and collapses when checked off.
  • But then I Collapse the box manually. The binding is now broken. Checking the checkbox or checking is off has no effect on expand/collapse of the expander. I am using one-way binding. I cannot use two-way binding as I do not want to check off the checkbox when the expander collapses.

Any help is appreciated.

Cheers.

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 20 Oct 2011, 05:25 PM
Hello Deepak Shakya,

 This is not a problem of the RadExpander, it's just the way the Binding works. Once you expand the Expander programmatically, the one way binding won't work. You can examine the same behavior with 2 CheckBoxes:

<CheckBox x:Name="cBox1" Content="chB1" IsChecked="{Binding ElementName=cBox,Path=IsChecked}" />
 
            <CheckBox x:Name="cBox" Content="CHeckBox" />
So you need a custom check/uncheck cinchonization that cannot be done with Bindings only. You need to use Checked/Uncheck events ( Expanded/Collapsed of the Expander) in order to achieve the desired functionality.Best wishes,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
Expander
Asked by
Deepak Shakya
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or