tags:

views:

242

answers:

1

Hi,
In WPF I want to have a button that when clicked, it either opens or closes a Popup depending on whether or not it's already open (Close it if it's open, Open it if it's closed), and I want to do this purely in XAML. Is this possible?

Thanks,
Roy

+3  A: 

Yes, you will need to use a ToggleButton rather than a standard button. Then you should be able to bind the Popup.IsOpen property to the ToggleButton.IsChecked property.

If you need a XAML snippet demonstrating this, I can make one in a couple minutes. But this should be straightforward enough.

Charlie