Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't bind to IsExpanded on Expander
    primarykey
    data
    text
    <p>Blacklight is an older set of WPF controls and styles. The code can be found <a href="http://blacklight.codeplex.com" rel="nofollow">here</a>. It contains a control called AnimatedExpander which isn't really an expander, rather it just implements HeaderedContentControl and adds an IsExpandedProperty dprop:</p> <pre><code> public static readonly DependencyProperty IsExpandedProperty = DependencyProperty.Register("IsExpanded", typeof(bool), typeof(AnimatedExpander), new PropertyMetadata(true)); public bool IsExpanded { get { if (this.expandToggleButton != null) { return this.expandToggleButton.IsChecked.Value; } return (bool)GetValue(IsExpandedProperty); } set { SetValue(IsExpandedProperty, value); } } </code></pre> <p>I need to bind to IsExpanded so that I can persist whether expanders are expanded. I'm pretty sure I have the binding setup correctly, and that there is a problem with this custom dependency property. If I open the view in Snoop, and set the IsExpanded=True on the expander, the binding works. However, just clicking the expandToggleButton on the control only expands the control, it doesn't hit my binding.</p> <pre><code> &lt;controls:AnimatedExpander IsExpanded="{Binding SGGExpanderExpanded}" /&gt; private bool _sGGExpanderExpanded; public bool SGGExpanderExpanded { get { return _sGGExpanderExpanded; } set { if (_sGGExpanderExpanded != value) { _sGGExpanderExpanded = value; OnPropertyChanged("SGGExpanderExpanded"); } } } </code></pre> <p>How can I bind to a value that changes when the user clicks the toggle button that is wired to expand the control?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload