开发者

WPF: One-way IValueConverter

开发者 https://www.devze.com 2022-12-18 00:36 出处:网络
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.

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


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消