Joan Venge
Joan Venge

Reputation: 331540

How to hide a button in Silverlight/WP7?

I saw a question here showing to use this:

button.Visibility = Visibility.Hidden;

but I only have Collapsed or Visible, and Collapsed removes the button which changes the layout of the controls which I don't want.

Any ideas on how to solve this?

Upvotes: 2

Views: 2293

Answers (2)

Netlight_Mobile
Netlight_Mobile

Reputation: 194

Another solution if you don't want to resort to changing the Opacity would be encapsulate the button within a Grid and set the Grid height property to fixed size corresponding to the button height. Now you can Collapse the button without other controls rearranging themselves.

Cheers, Anders

Upvotes: 3

Orkun
Orkun

Reputation: 7268

Apparently you are on the Silverlight framework which doesnT have the Hidden option.

Silverlight does not support the Hidden Visibility state.

You can see the available members in both .Net framework and Silverlight in the reference . (use the dropdown on top of the page to switch between different platforms)

A crooked solution to your problem could be setting the opacity of the UI element to 0 but this approach is known to have performance drawbacks.

Upvotes: 4

Related Questions