Recommended

Skip Navigation LinksHome / News / View News

A Universal Value Converter for WPF

+ Add to SilverlightShow Favorites
0 comments   /   posted by Silverlight Show on Jul 12, 2010
(0 votes)
In this post, Colin Eberhardt provides a simple IValueConverter implementation that makes use of the framework type converters in order to convert between a large range of source / target types.

Wouldn’t it be great to have a single value converter that has the same flexibility as the XAML parser? It is actually very simple to create such as converter (and after creating probably my 5th ColorToBrushConverter I have no idea why it took so long before I realised this!). The .NET framework has had an API for conversion between different types via TypeConverters for a long time. They used extensively in .NET technologies for databinding and designer support, and much more.

Share


Comments

Comments RSS RSS
No comments

Add Comment

 
 

   
  
  
   
Please add 2 and 2 and type the answer here:

Join the free SilverlightShow webinar 'Silverlight Behaviors for Designers' on July 14th 2010, 3:00pm EDT.
In this session on adding interactivity UX Designer and Consultant Zhivko Dimitrov will show how to bring your designs to life without writing a single line of code! Find out how to use drag & drop behaviors to control animations, add navigation, and simulate validation states. Read more | Register Now (hide this)