Binding not working in CellEditTemplate with DataGridDateColumn

1 Answer 164 Views
DataGrid TimePicker
Osayed
Top achievements
Rank 1
Osayed asked on 01 Sep 2022, 04:20 PM

Hello, I am trying to set a custom CellEditTemplate for a Date Column so that I can make it edit the time not just the date, but the binding is not working at all.

And it says this error: "Binding: 'Time' property not found on 'Telerik.Maui.Controls.Compatibility.DataGrid.DataGridCellEditContext', target property: 'Telerik.Maui.Controls.RadTimePicker.Time'"


  <telerik:DataGridDateColumn PropertyName="Time" 
                                            HeaderText="Time">

                    <telerik:DataGridColumn.CellEditTemplate>
                        <DataTemplate>
                            <telerik:RadTimePicker Time="{Binding Time}"></telerik:RadTimePicker>
                        </DataTemplate>
                    </telerik:DataGridColumn.CellEditTemplate>

                </telerik:DataGridDateColumn>

1 Answer, 1 is accepted

Sort by
0
Antoan
Telerik team
answered on 02 Sep 2022, 10:34 AM

Hi Osayed,

Whenever you are using a CellContentTemplate it would be enough to set a binding directly to the property. However when you are using CellEditTemplate you need to specify the item you are accessing, this looks as follows: 

<telerik:DataGridColumn.CellEditTemplate>
                        <DataTemplate>
                            <telerik:RadTimePicker Time="{Binding Item.Time, Mode=TwoWay}"/>
                        </DataTemplate>
</telerik:DataGridColumn.CellEditTemplate>

Example is provided here: https://github.com/telerik/maui-samples/blob/5e0097e9c3410a14fb254d13e2d1c66ad33ceebf/Samples/SdkBrowser/Examples/DataGridControl/ColumnsCategory/CellEditTemplateExample/CellEditTemplate.xaml#L18 

Let me know if this fixes the issue.

Regards,
Antoan
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
DataGrid TimePicker
Asked by
Osayed
Top achievements
Rank 1
Answers by
Antoan
Telerik team
Share this question
or