Reputation: 3241
I want to disable a button in silverlight, does it has a disable property that can bind to a variable?
thanks :)
Upvotes: 1
Views: 118
Reputation: 6932
If you have some sort of ViewModel with a bool
property
public bool CanDoSomething
{
get { return _canDoSomething; }
set
{
if (_canDoSomething != value)
{
_canDoSomething = value;
RaisePropertyChanged("CanDoSomething");
}
}
}
Then you can bind the Button in XAML with something like
<Button IsEnabled="{Binding Path=CanDoSomething}" />
Upvotes: 2
Reputation: 69362
To disable a button, you can use
myButton.IsEnabled = false;
All UIElements have this property.
Upvotes: 2