Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1585
DatePicker in UnboundColumn
posted

When I have a DatePicker control as my EditorTemplate for an UnboundColumn and I type in the date as oppossed to clicking the calendar icon to select one... then I click into the next cell in the same row, the ItemTemplate for the cell doesnt get updated with the new date. I have attached an example proj that recreates it.

To reproduce it, click into the date column, type in a new date, then click into the cell next to it, thats in the same row...you will see thechange is not reflected into the item template. If you click back into the date column, then click back out then its updated. It only works correctly if you click on the datepicker icon and select a date, then click into the cell next to it in the same row. the value updates into the item template like it should. How can I fix this?

Parents
No Data
Reply
  • 40030
    Verified Answer
    Offline posted

    Hi, 

    Ah, the joys of the DatePicker. I can tell you that our own DateColumn which uses the DatePicker has lots of fun tweeks to handle the nuances of this control. 

    The problem is, that when you type in a date, it doesn't update right away, there is actually quite a lag between when you loose focus and its applied.

    To make this work in your sample, you can specify a DateTemplate for the ItemTemplate property, which will allow the textBlock to be updated automatically when the property changes. THe problem with the valueConverter, is that it isn't notified, which is why its not updated:

                        column.ItemTemplate = (DataTemplate)XamlReader.Load(

                        @"<DataTemplate xmlns=""http://schemas.microsoft.com/client/2007"" xmlns:uc=""clr-namespace:XamGrid;assembly=XamGrid"">

                            <TextBlock Text=""{Binding " + String.Format("RowData.Cells[{0}].Value", i) + " }\" /></DataTemplate>");

    Hope this helps, 

    -SteveZ

Children
No Data