Interrelated Properties in WPF

Properties in WPF work much differently.  When creating a property, the new dependency model is used.  I'm not going to go in-depth into this; there's plenty of resources using it.  Oftentimes, dependency properties are public static fields of type DependencyProperty, that use the DependencyProperty.Register static method to create an instance of it.

Within the definition of the dependency property, there are options to specify validation callbacks and coercion callbacks.  Property validation and property coercion work in different ways.  Validation is used to determine if the property is a valid value, and returns a boolean to that effect.  This type of validation accesses only the property value at hand, and cannot access other values of the property.

Coercion works in a different way.  Coercion changes the value of a property based on other properties.  However, coercion works by changing the value, that is outside a respected range, into within the valid range.  For instance, if there are Minimum and Maximum property values, that define a range, and the Value property has to be within the range, coercion forces the Value within the range.

Comments

No Comments

The leading UI suite for ASP.NET - Telerik radControls
Outstanding performance. Full ASP.NET AJAX support. Nearly codeless development.