Geeks With Blogs

News kaleidoscope 1817, lit. "observer of beautiful forms," coined by its inventor, Sir David Brewster (1781-1868), from Gk. kalos "beautiful" + eidos "shape" (see -oid) + -scope, on model of telescope, etc. Figurative meaning "constantly changing pattern" is first attested 1819 in Lord Byron, whose publisher had sent him one.
Kaleidoscope Everything under the sun, ending in .Net

Here I am trying to provide step wise approach of implementing validations using IDataErrorInfo interface.

Steps to be carried out in ViewModel and Model classes:

  • Add reference to System.ComponentModel namespace.
  • Implement IDataErrorInfo interface in ViewModel and Model classes
  • Create sub routine for checking validations on Fields in ViewModel and Model classes

Sample Code in ViewModel class:

image

 

Steps to be following in XAML:

  • Set the ValidatesOnDataErrors property true for all the data entry controls.
  • Create a ContentRepresenter to display the error message.

Sample Code in XAML:

image

Technorati Tags: ,,
Posted on Thursday, July 1, 2010 12:35 AM | Back to top


Comments on this post: Steps to Implement Validations in MVVM design pattern in a WPF Applications:

# re: Steps to Implement Validations in MVVM design pattern in a WPF Applications:
Requesting Gravatar...
Disaster Recovery? What is this? A new application? If it is, then what is the main objective of this program? Love to see it in action. - Marla Ahlgrimm
Left by Marla Ahlgrimm on Feb 20, 2012 11:58 AM

Your comment:
 (will show your gravatar)


Copyright © kaleidoscope | Powered by: GeeksWithBlogs.net