Hi,
Simple problem. I need to have a xaml control set it's enabled property based on some logic. The form is one where it is in read only or read/write mode. So the "easy" solution I came up with was to create an EventCommand that was bound to the IsEnabledChanged event and then put the appropriate code in the method in my data model.
I need to be able to evaluate the property that is bound to the control from within that method
This should be really easy, but I can't figure out how to write the code in the data model so it works. Everything I try results in a runtime error.
So I need to create a style trigger that fires on IsEnabledChanged event and passes either the control or the property to which it is bound to a method in the data context. I can't use some other class because the datacontext has the data and can figure out if the given element should be editable or not.
So right now, the controls readonly state is set by this trigger:
<Setter Property="IsReadOnly" Value="{Binding inViewMode}" />
But when the control is enabled, I then need to decide if I have to disable it or not.
In winforms, I could just do something like:
enabled = checkField(name)
I am really close, but still missing something. Your help in the correct syntax to get this working would be apprewciated.
Thanks
me (and yes, I DO mark correct answers)