WPF: Dictionary Value Converter

Wednesday, August 10, 2011

What’s the story? You want to convert an enum value to a bitmap image. That’s easy, here’s a solution Usually you would simply create a new value converter which has some custom code (e.g. a switch –case statement) to convert from the enum value to the relevant image. Is there a better solution? How many times have you written this kind of converter, the kind that takes a value and maps it to another value? Well, no more! I present to you: DictionaryValueConverter. A Converter that lets you define a collection...
no comments

Implementing IValueConverter in WPF – Screencast [HEB]

Monday, July 18, 2011

This screencast is a direct continuation of the previous one, where I showed how to use an object implementing IValueConverter in WPF. In this screencast I show how to implement IValueConverter to provide custom logic when performing data binding. Please notice that the screencast was recorded in Hebrew, but the demo is clear enough to be watched without understanding a word. You can watch the screencast on YouTube HD here. Or here, embedded in my blog:     On my next screencast we will see how you to use Multi-Binding in a WPF...

Using IValueConverter in WPF – Screencast [HEB]

Sunday, July 10, 2011

Recently, I've recorded some screencasts that demonstrates common techniques when implementing line-of-business applications in WPF. In the coming month, each week, I will release a new screencast on a topic of choice. I've decided to start my screencasts with a few common binding techniques. In the first screencast I give a simple demonstration on how to use IValueConverter in a WPF application. Please notice that the screencast was recorded in Hebrew, but the demo is clear enough to be watched without understanding a word. You can watch the screencast on YouTube HD here. Or here, embedded in my blog:On my next screencast we...

WPF: Where to put value converters?

Thursday, January 28, 2010

The following tip is not new; it is based on this post and its comments. However, for the sake of completeness and for future reference I bring here the final version. The question this posts tries to address is: Where to put value converters? Normal Solution Usually, the common place to put value converters is in the resources section. With this in place you can use the value converter with StaticResource syntax: <UserControl.Resources>    <local:NotConverter x:Key="notConverter" /></UserControl.Resources>...<StackPanel>    <Button IsEnabled="{Binding Converter={StaticResource notConverter}}" /></StackPanel> This means that every time you want to use the value converter you need to add it to the resources section. A better...