Quantcast
Channel: Caliburn.Micro: Xaml Made Easy
Viewing all articles
Browse latest Browse all 1760

New Post: How to detect Clean, Dirty, Invalid status of View (not ViewModel)

$
0
0
Only the Binding knows the View's Dirty (and Valid) state

given that both the ViewModel and View needs this information

it would make sense for the Binding (or BindingGroup) to communicate this to the ViewModel

(in much the same way it communicates TextBox.Text to the ViewModel)

For most use cases the following would suffice:
public bool IsDirty { get; set; }
public bool IsValid { get; set; }
This could be convention-bound by CM

and then:
public bool CanSave { get { return IsDirty && IsValid; } }
public bool CanCancel { get { return IsDirty; } }
Without this mechanism the UI is not communicating with the User correctly and the experience won't be high-quality

Viewing all articles
Browse latest Browse all 1760

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>