且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用Converter进行Datatemplate后台无法正常工作。

更新时间:2023-02-01 15:15:05

我发现问题不是我的XAML,而是我的IValueConveter实现。



对于遇到此问题的其他人,请检查您从转换器返回的刷子类型。



我正在返回一个System.Drawing.Brush,它需要是一个System.Windows.Media.Brush对象。
I found out that the issue was not with my XAML, instead it was with my IValueConveter implementation.

For others that come across this issue, check what type of "Brush" you are returning from the converter.

I was returning a "System.Drawing.Brush" and it needed to be a "System.Windows.Media.Brush" object.