tags:

views:

51

answers:

2

I am using different toggle buttons and buttons in the view. I need to use the IsEnabled and IsChecked property of the toggleButtons in the view Model to diable some buttons and toggle buttons based on some conditions. Suggest me any methods to access any properties of a control in the view to the view model.

+2  A: 

Bind them to exposed properties in the View Model so you don't break the separation between View and View Model.

In this case, you can bind the "IsEnabled" to a "SomethingIsEnabled" and then when that is set, re-evaluate your command status based on the properties current value.

I have noticed that for state within the View Model, I end up creating a lot of things like this to keep the "logic" in the View Model, instead of reading the View.

Tom Anderson
A: 

Hi Hemanth,

You should try DelegateCommand.

HTH

Avatar