How do I add a custom convention to Caliburn.Micro for the IsEnabled
property of controls - something like having NameEnabled
bound to IsEnabled
in parallel to Name
bound to Text
on a TextBox.
In a way, what I want to achieve is similar to the way that a CanSave
property can be used to enable/disable a button bound to a Save
method, but generic for all controls.
Caliburn.Micro right now (1.3.1) doesn't really support this "multiple" conventions for the same
FrameworkElement
, what you have described.EDIT:
However you can hook into the
ViewModelBinder.BindProperties
method and there you can implement your own extra convetion.I went one step further and implemented a prototype which works, but it's not robust, nor elegant and probably not the correct way to do this. But it can be a starting point: