Silverlight DataGridTemplateColumn与DataGridTextColumn

时间:2010-06-18 14:45:22

标签: silverlight datagridtemplatecolumn datagridtextcolumn

为什么这样做......

<data:DataGridTemplateColumn Header="YTD v. Exchange" x:Name="YTDvExchange" Visibility="Collapsed" CanUserSort="True" SortMemberPath="ytdExchangeReturn.value">
                    <data:DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <TextBlock  TextAlignment="Right" VerticalAlignment="Center"
                                    Text="{Binding ytdExchangeReturn.value, Converter={StaticResource fcFixedDecimalConverter}}"
                                    Foreground="{Binding ytdExchangeReturn.value, Converter={StaticResource fcForegroundValueConverter}}"/>
                        </DataTemplate>
                    </data:DataGridTemplateColumn.CellTemplate>
                </data:DataGridTemplateColumn>

但这不是......

<data:DataGridTextColumn Header="YTD v. Exchange"
                    Binding="{Binding ytdExchangeReturn.value, Converter={StaticResource fcFixedDecimalConverter}}"
                    Foreground="{Binding ytdExchangeReturn.value, Converter={StaticResource fcForegroundValueConverter}}"/>

我得到第二个'System.Windows.Markup.XamlParseException:AG_E_PARSER_BAD_PROPERTY_VALUE'。该问题适用于Foreground转换器,绑定很好。

1 个答案:

答案 0 :(得分:2)