WPF Reflections:

March, 2008

March 31, 2008  11:03 PM

Data validation in WPF, my approach

Mark Shurmer Profile: MarkWPF

Whether to use IDataErrorInfo or ValidationRule - that is the question, as I posed in a previous post. So , you may be wondering what do I do in my WPF projects? Or you may not :-) Well,...

March 31, 2008  11:01 PM

Data validation in WPF using ValidationRule

Mark Shurmer Profile: MarkWPF

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

Mark Shurmer Profile: MarkWPF

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


Mark Shurmer Profile: MarkWPF

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 14, 2008  3:47 PM


Mark Shurmer Profile: MarkWPF

I went to DevWeek08 this week, and saw some excellent presentations, and some not so.... I particularly liked the talks by Christian Weyer and Richard Blewett on .Net 3.5 However, there wasn't a huge amount of WPF stuff. I saw a couple of talks by David Wheeler, just to see how it was panning...

March 10, 2008  9:39 PM

Re-using data template across controls

Mark Shurmer Profile: MarkWPF

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

Mark Shurmer Profile: MarkWPF

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

Mark Shurmer Profile: MarkWPF

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...

March 4, 2008  5:56 PM

Controlling how the source is updated in a binding

Mark Shurmer Profile: MarkWPF

Have you ever wondered how to alter the update frequency of a binding? Probrably like me, you use the default settings unless you notice something not working :-) What am I talking about? Well, when you have a binding defined to another element for example: <TextBox Name="txtFirstOne"...

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: