PropertyDefinition IsExpanded binding have no effect

2 posts, 0 answers
  1. rui
    rui avatar
    34 posts
    Member since:
    May 2014

    Posted 21 Jul 2015 Link to this post

    I use a checkbox PropertyDefinition  which contains NestedProperties,  I want to achieve the checkbox and the expand keep the same status, when the checkbox is checked the nestedProperties expand and when the checkbox is unchecked the nestedProperties unexpand    the code is as follow

                    <telerik:PropertyDefinition
                                                Binding="{Binding ​IsShowDetail}"
                                                IsExpanded="{Binding ​IsShowDetail}">
                        <telerik:PropertyDefinition.NestedProperties>
                            <telerik:PropertyDefinition Binding="{Binding Path=Name,
                                                                          Mode=TwoWay}"/>
                            <telerik:PropertyDefinition Binding="{Binding Path=Description,
                                                                          Mode=TwoWay}"/>
                        </telerik:PropertyDefinition.NestedProperties>
                    </telerik:PropertyDefinition>

     The "IsShowDetail " is a bool property,  the "Binging "and "IsExpanded "both binding to this property

    but the "IsExpanded "have no effect

    what is the reason for this and how to achieve this effect?

    thanks 

  2. Ivan Ivanov
    Admin
    Ivan Ivanov avatar
    1128 posts

    Posted 24 Jul 2015 Link to this post

    Hi,

    PropertyDefinition derives from DependencyObject. Thus it supports data binding, but it does not have a default binding source (DataContext). So that you have to defined the source for the IsExpanded binding explicitly. You can expose the assigned Item/ViewModel instance as a StaticResource and refer to it in the binding definition.
    The "Binding" property works with data bindinng without specifying explicit source, because it gets assigned to the respective editor control, which generally derives from FrameworkElement and FrameworkElelement supports DataContext. RadPropertyGrid internally assigns the Item as a DataContext for its editors.

    Regards,
    Ivan Ivanov
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top