DatePicker Crashes when trying to edit a DataGrid

Apr 25, 2009 at 11:04 AM
Can someone tell my what I am doing wrong.
When I try to edit, it crashes with the following message 

'DatePicker' TargetType does not match type of element 'TextBox'.

My source code.

  <toolkit:DataGridTextColumn Header="Dato" CanUserSort="False">
                        <toolkit:DataGridTextColumn.ElementStyle>
                            <Style TargetType="{x:Type TextBlock}">
                                <Setter Property="Text" Value="{Binding Path=Dato, StringFormat=m}"/> 
                                <Setter Property="Margin" Value="5,0"/>
                            </Style>
                        </toolkit:DataGridTextColumn.ElementStyle>
                        <toolkit:DataGridTextColumn.EditingElementStyle>
                            <Style TargetType="{x:Type toolkit:DatePicker}">
                                <Setter Property="SelectedDate" Value="{Binding Path=Dato, Mode=TwoWay}"/>
                                <Setter Property="Margin" Value="5,0"/>
                            </Style>
                        </toolkit:DataGridTextColumn.EditingElementStyle>
                    </toolkit:DataGridTextColumn>

Coordinator
Apr 26, 2009 at 10:50 PM
You cannot use the default DataGridTextColumn as a placeholder for a DatePicker.  Try the DataGridTemplateColumn instead.