Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

WPF Validation and MVVM

$
0
0

Hello,

I have a View which has custom validation rules applied to some TextBoxes.

My problem is my View has a Save Button bound to a Command, which has a CanSave boolean method for being enabled.

The ViewModel has no knowledge of my View's Validation success or failures, so the button is enabled always. My validation logic is not in my ViewModel or Model, because I'm using custom validation rules, my View simply has the validation bindings directly in it (just like it should be).

 

So my question is, how on earth can someone check the validation rules (at least if any exist) within a ViewModel when the View is the one that has the bindings to custom validation rules?


My educational lectures on C# and .Net in general (ranging from beginner level topics to advanced topics): mariocatch.wordpress.com

Viewing all articles
Browse latest Browse all 18858

Trending Articles



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