gpt4 book ai didi

silverlight - 将前景转换器添加到 xaml 中的 DatagridTextColumn

转载 作者:行者123 更新时间:2023-12-01 05:44:51 27 4
gpt4 key购买 nike

我正在尝试将转换器添加到 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()

...

这是错误信息

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] at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator) at Module1.MyIdeas..ctor() at Module1.Template..ctor() at Module1.MyApp..ctor()

最佳答案

没试过,但那里的人声称它有效

http://forums.silverlight.net/forums/p/151524/338879.aspx#338879

关于silverlight - 将前景转换器添加到 xaml 中的 DatagridTextColumn,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2959337/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com