Reputation: 337
I have following DataGrid in wpf.
<DataGrid AutoGenerateColumns="False" Grid.Row="1" Name="adsGrid" ItemsSource="{Binding Path=Ads}" CanUserAddRows="False" CanUserDeleteRows="False" SelectionChanged="adsGrid_SelectionChanged">
<DataGrid.Columns>
<DataGridTextColumn Header="ID" Binding="{Binding Path=ID}" IsReadOnly="True" />
<DataGridTextColumn Header="File" Binding="{Binding Path=FileName}" IsReadOnly="True" />
<DataGridTemplateColumn Header="Expiration date" IsReadOnly="True">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<DatePicker SelectedDate="{Binding Path=ExpirationDate}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn Header="Info" Width="100*" Binding="{Binding Path=Info}" />
</DataGrid.Columns>
</DataGrid>
Problem is that DateTime picker won't update related object but will read value from it. I've tried adding Mode=TwoWay but it didn't help. Other properties are updated properly.
Upvotes: 1
Views: 2656
Reputation: 32745
To debug this I would try:
DateTime
(not a nullable or DateTimeOffset?)UpdateSourceTrigger=PropertyChanged
Upvotes: 5