Strange Behaviour in DataGrid SilverLight 3 Control

Posted by Asim Sajjad on Stack Overflow See other posts from Stack Overflow or by Asim Sajjad
Published on 2010-03-18T05:08:27Z Indexed on 2010/03/18 5:11 UTC
Read the original article Hit count: 301

Filed under:

Here is the my Xaml Code. Here I have changed the Foreground of the cell depending on the current age of the person.

<data:DataGridTemplateColumn Header="First Name" Width="150" MinWidth="150" CanUserReorder="False" SortMemberPath="FirstName">
                <data:DataGridTemplateColumn.CellTemplate>
                    <DataTemplate >
                        <TextBlock   Foreground ="{Binding Path=DateOfBirth,Mode=OneWay,Converter={StaticResource CellColor}}" Text="{Binding FirstName}" ToolTipService.ToolTip="{Binding FirstName}"  FontFamily="Arial" FontSize="11"  VerticalAlignment="Center" Margin="5,0,0,0" />
                    </DataTemplate>
                </data:DataGridTemplateColumn.CellTemplate>
            </data:DataGridTemplateColumn>
            <data:DataGridTextColumn Foreground ="{Binding Path=DateOfBirth,Mode=OneWay,Converter={StaticResource CellColor}}"  Header="Last Name" Width="150" MinWidth="150" Binding="{Binding LastName}" CanUserSort="True" IsReadOnly="True" CanUserReorder="False"/>

When I run the above code it return following Exception

AG_E_PARSER_BAD_PROPERTY_VALU

My question is that when I remove the Foreground converter from the DataGridTextColumn Column it runs fine As the Foreground converter is applied in the DataGridTemplateColumn Column which will not through excepction. But when I used same Converter to the DataGridTextColumn it throw execption why, can anyone know why is th is behaviour

thanks in advance.

© Stack Overflow or respective owner

Related posts about silverlight-3.0