0

is there an option to have a CanChange method for a property in my ViewModel, to automatically enable and disable a input field (RadioButton, TextBox, ...) according to the return value of the CanChange method?

This is currently possible for Command with the canExecute delegate, which enables/disables a button based on the canExecute method's return value.

Having such an option would save me a lot of code.

Thanks in advance!

pgross
  • 510
  • 5
  • 16

1 Answers1

0

Normally this is taken care of using a "Is[FieldName]ReadOnly" or a converter. Unfortunately I don't know what the reasons are why a field must be enabled/disabled, so I cannot give you a complete answer. In Catel there are some generic ways to check security and enable/disable controls based on the results.

What you can do is to create a generic IAuthenticationProvider as explained here to enable/disable fields in a generic way (for example, based on roles, or if models are read-only, or whatever you like).

You can also check out the tons of converters that ship with Catel.

Geert van Horrik
  • 5,689
  • 1
  • 18
  • 32