I am trying to add a converter to a DataGridTextColumn to convert a foreground brush based on the cell value in the xaml file. DecimalConverter works fine and follows the same pattern.
Here is my 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}}" />
Here is the converter ...
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()
...
Here is the error message
Message: Unhandled Error in Silverlight Application Code: 4004
Category: ManagedRuntimeError
Message: System.Windows.Markup.XamlParseException: AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 29 Position: 32] on System.Windows.Application.LoadComponent (Component Object, Uri resourceLocator) with Module1.MyIdeas..ctor () at Module1.Template..ctor () at Module1.MyApp..ctor ()
source share