Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF: One-way IValueConverter

From what I've been told, I need to create an IValueConverter to do my custom formatting. The problem is my formatting is one-way, there is no legitmate ConvertBack implementation.

So, how do I handle one-way IValueConverters. (If it helps, this is for a read-only control.)

like image 831
Jonathan Allen Avatar asked Jan 27 '10 03:01

Jonathan Allen


1 Answers

All the examples from Microsoft simply throw a NotSupportedException or a NotImplementedException (the former makes more sense) from the ConvertBack method.

As you say, if the converter is one-way then chances are you'll be using it on a read-only control like TextBlock, so the ConvertBack method won't be getting called anyway.

like image 165
Matt Hamilton Avatar answered Sep 22 '22 21:09

Matt Hamilton