C# Class Bennedik.Validation.Integration.WPF.ErrorProvider

This ErrorProvider is adapted to the Validation Application Block from Paul Stovell's CodeProject article at http://www.codeproject.com/WPF/wpfvalidation.asp. The ErrorProvider is a Decorator. It adds an EnterpriseValidationRule to all contained Bindings.
(c) 2007, 2008 Martin Bennedik, see BSD license in the license.txt file http://www.bennedik.de
Inheritance: System.Windows.Controls.Decorator
Show file Open project: RookieOne/WPF-Input-Validation

Private Properties

Property Type Description
AddEnterpriseValidationRule void
ErrorProvider_Loaded void
FindBindingsRecursively void

Public Methods

Method Description
ErrorProvider ( ) : System
GetFirstInvalidElement ( ) : FrameworkElement

Returns the first element that this error provider has labelled as invalid. This method is useful to set the users focus on the first visible error field on a page.

Init ( ) : void
Validate ( ) : bool

Validates all properties on the current data source.

Note that only errors on properties that are displayed are included. Other errors, such as errors for properties that are not displayed, will not be validated by this method.

Private Methods

Method Description
AddEnterpriseValidationRule ( FrameworkElement element, Binding binding, DependencyProperty dp ) : void
ErrorProvider_Loaded ( object sender, RoutedEventArgs e ) : void
FindBindingsRecursively ( DependencyObject element, FoundBindingCallbackDelegate callbackDelegate ) : void

Recursively goes through the control tree, looking for bindings on the current data context.

Method Details

ErrorProvider() public method

public ErrorProvider ( ) : System
return System

GetFirstInvalidElement() public method

Returns the first element that this error provider has labelled as invalid. This method is useful to set the users focus on the first visible error field on a page.
public GetFirstInvalidElement ( ) : FrameworkElement
return System.Windows.FrameworkElement

Init() public method

public Init ( ) : void
return void

Validate() public method

Validates all properties on the current data source.
Note that only errors on properties that are displayed are included. Other errors, such as errors for properties that are not displayed, will not be validated by this method.
public Validate ( ) : bool
return bool