简体   繁体   中英

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 IValueConverter s. (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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM