Binding to a WPF ToggleButton's IsChecked state

Viewed 38138

I would like to use a WPF ToggleButton to expand and collapse some controls in my application. How can I use XAML to accomplish this?

I'm thinking that I could somehow bind the Visibility attribute of some controls to the ToggleButton's IsChecked state, but I do not know how to do this.

Maybe I need to give my ToggleButton a Name, then bind using ElementName? Then I would need a ValueConverter for converting between a boolean value and a Visibility, correct? How could I make a generic ValueConverter for this purpose?

3 Answers
Related