我正在尝试将转换器添加到DataGridTextColumn,以根据xaml文件中单元格的值转换前景画笔。 DecimalConverter工作正常并遵循相同的模式。
这是我的xaml ......
<UserControl.Resources>
<y:FixedDecimalConverter x:Key="FixedDecimalConverter" />
<y:ForegroundValueConverter x:Key="ForegroundValueConverter" />
</UserControl.Resources>
...
<data:DataGridTextColumn
Header="Absolute Return"
Binding="{Binding totalAbsoluteReturn.value, Converter={StaticResource FixedDecimalConverter}}"
Foreground="{Binding totalAbsoluteReturn.value, Converter={StaticResource ForegroundValueConverter}}" />
这是转换器...
type ForegroundValueConverter() =
interface IValueConverter with
member this.Convert(value, targetType, parameter, culture) =
let o: obj = upcast new SolidColorBrush(Colors.Red);
o
member this.ConvertBack(value, targetType, parameter, culture) = raise <| NotImplementedException()
...
以下是错误消息
消息:未处理的错误 Silverlight应用代码:4004
类别:ManagedRuntimeError
信息: System.Windows.Markup.XamlParseException: AG_E_PARSER_BAD_PROPERTY_VALUE [行: 29位置:32] at System.Windows.Application.LoadComponent(对象 组件,Uri resourceLocator) Module1.MyIdeas..ctor()at Module1.Template..ctor()at Module1.MyApp..ctor()
答案 0 :(得分:1)
没有尝试过,但那里的人声称它有效
http://forums.silverlight.net/forums/p/151524/338879.aspx#338879