PaulB
PaulB

Reputation: 24422

Changing a property of something in XAML from a button click

Given the following bit of XAML

<Border Name="Brder" Visibility="Visible" Width="10" Height="10" Background="Red"></Border>
<Button Content="Hide"></Button>

How can I set the button click to change the visibility of the border (not using code behind)?

I know it's trivial in code behind and the routed click event only seems to allow storyboard manipulation?

Thanks

Upvotes: 3

Views: 1758

Answers (1)

Wallstreet Programmer
Wallstreet Programmer

Reputation: 9677

If you change the Button to a ToggleButton you can bind visibility to IsChecked of the ToggleButton using XAML only. Also remember that Expanders support this behavior as well and you can laways style them if you don't like the default look.

Upvotes: 2

Related Questions