WPF Reflections:

XAML


March 31, 2008  11:01 PM

Data validation in WPF using ValidationRule



Posted by: MarkWPF
Databinding, Microsoft Windows, Validation, Windows Computing, WPF, XAML

As I mentioned in a previous post, you can specify validation by creating a Validation class (or classes). You do this by deriving a new class from the ValidationRule class and overriding the...

March 26, 2008  8:49 AM

Data validation using IDataErrorInfo



Posted by: MarkWPF
Databinding, WPF, XAML

As per a previous post, how do you do data validation in WPF using IDataErrorInfo? Well what does IDataErrorInfo give you? It defines two properties: public string Error { get; } public string this[string columnName] { get; } When you implement these, you provide error validation...


March 14, 2008  4:50 PM

Validation



Posted by: MarkWPF
Validation, WPF, XAML

There seems to be four ways to go with validation with WPF:

  1. Use IDataErrorInfo
  2. Use custom classes with ValidationRule
  3. Combine 1 and 2
  4. Roll your own
What do I mean by each of these, and why?
  1. Use IDataErrorInfo. You canimplement...


March 10, 2008  9:39 PM

Re-using data template across controls



Posted by: MarkWPF
Databinding, WPF, XAML

How do you use the same data template across different types of control? Well you can :-) Normally when you define the data template, you do something like the following: <DataTemplate DataType="{x:Type ListViewItem}> <TextBlock Text="{Binding Path=ISIN}"...


March 9, 2008  6:53 AM

Multi value converter in databinding



Posted by: MarkWPF
C, Databinding, WPF, XAML

Here's a nifty little trick that I recently discovered. When you need to calculate the result of two properties and display it, you can do it via a Converter class. You may want to do it, like me, if you couldn't update the business objects, or didn't want to. How do you do it? Your...


March 6, 2008  2:45 PM

Explicit control of how the source is updated



Posted by: MarkWPF
Databinding, WPF, XAML

In a previous post, I described how you can get a binding to update in real time - i.e. as you type. Sometimes however, you want to control the updating more closely, i.e. in code. For example, you may want to do the update only when a timer has ticked. There is a little used argument for...


Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to: