WPF: Where to put value converters?

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

How not to write C# applications?

January 9, 2010

In my new job at Sela I came across an application ( written by a client) that needed refactoring. This app has so many coding errors I’ve decided it worth its own post. Why not rewrite the application? You could suggest to rewrite the application but I’m strongly against it. To understand why you MUST read the excellent article Things You Should Never Do by Joel Spolsky. Go ahead and read it, it’s more important then reading this post! Code Duplication Never write the same code twice. I know, it’s so obvious but nevertheless a common (bad) practice. Every time you...
no comments