tags:

views:

100

answers:

3

i want to hide button in wpf i used in widows form ex : button.visible=false what 's equivelant to that in wpf ??

thank in advance

+1  A: 

Visibility = Hidden

František Žiačik
+1  A: 

You should set

button.visibility = System.Windows.Visibility.Hidden;

or

button.visibility = System.Windows.Visibility.Collapsed;

or by using the WPF XAML property set the same...

Gianluca Colucci
+4  A: 

Try one of these:

button.Visibility = Visibility.Hidden;
button.Visibility = Visibility.Collapsed;

Hidden hides the button but the button will still take up space in the UI. Collapsed will collapse the button such that it has zero width and height.

Jakob Christensen
Note that if you are using DataBinding you need to write a ValueConverter that converts the bool to Visibility values.
Tigraine
Note that if you are using DataBinding you need to write a ValueConverter that converts the bool to Visibility values.
Tigraine
Such a converter already exists. http://msdn.microsoft.com/en-us/library/system.windows.controls.booleantovisibilityconverter.aspx
YotaXP