Reputation: 37
Like button.IsVisible = false isn't working... It gives error:
Property or indexer 'System.Windows.UIElement.IsVisible' cannot be assigned to -- it is read only
I'm making a WPF application...
Upvotes: 1
Views: 2752
Reputation: 61379
You don't use IsVisible
in WPF, you set the Visibility
property:
button.Visibility = Visibility.Collapsed;
Or, to make it visible:
button.Visibility = Visibility.Visible;
Technically, there is also Visibility.Hidden
which doesn't remove it from the layout. This isn't used very often, and is one of the "Know what you are doing before using" kind of options.
Upvotes: 5