Binding to IsChecked property of checkbox

2 posts, 0 answers
  1. Deepak Shakya
    Deepak Shakya avatar
    118 posts
    Member since:
    Aug 2007

    Posted 18 Oct 2011 Link to this post


    • 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.

  2. Petar Mladenov
    Petar Mladenov avatar
    2992 posts

    Posted 20 Oct 2011 Link to this post

    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 >>

Back to Top