Hi everyone and Happy New Year,
I am trying to create a datagrid with a start time column and end time column of a process followed by a third column that calculates automatically on input the time difference. The datas source come from a MSSQL server through a datatable and the start time and end times columns are in datetime datatypes. I should mention also that the data is input through the extended wpf toolkit datetimeupdown picker and I would like to have the data saved back to the MSSQL server through bindings. Im not sure how to proceed with this at all so if anybody knows how I could proceed with this I would be very thankful. Code would also be a bonus as I could not find a useful example of this on the internet.
Below is an image of my datagrid:
and the code to generate the first 3 columns.
<DataGridTemplateColumn Header="START OF TRANSFER" Width="*"><DataGridTemplateColumn.CellTemplate><DataTemplate ><TextBlock Height="18"><TextBlock.Text><Binding Path="STARTTRANSFER" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" /></TextBlock.Text></TextBlock></DataTemplate></DataGridTemplateColumn.CellTemplate><DataGridTemplateColumn.CellEditingTemplate><DataTemplate><wpfx:DateTimeUpDown Format="Custom" FormatString="HH:mm"><wpfx:DateTimeUpDown.Value><Binding Path="STARTTRANSFER" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay" /></wpfx:DateTimeUpDown.Value><wpfx:DateTimeUpDown.Text><Binding Path="STARTTRANSFER" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay" /></wpfx:DateTimeUpDown.Text></wpfx:DateTimeUpDown></DataTemplate></DataGridTemplateColumn.CellEditingTemplate></DataGridTemplateColumn><DataGridTemplateColumn Header="END OF TRANSFER" Width="*"><DataGridTemplateColumn.CellTemplate><DataTemplate ><TextBlock Height="18"><TextBlock.Text><Binding Path="ENDTRANSFER" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" /></TextBlock.Text></TextBlock></DataTemplate></DataGridTemplateColumn.CellTemplate><DataGridTemplateColumn.CellEditingTemplate><DataTemplate><wpfx:DateTimeUpDown Format="Custom" FormatString="HH:mm"><wpfx:DateTimeUpDown.Value><Binding Path="ENDTRANSFER" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay" /></wpfx:DateTimeUpDown.Value><wpfx:DateTimeUpDown.Text><Binding Path="ENDTRANSFER" UpdateSourceTrigger="PropertyChanged" Mode="TwoWay" /></wpfx:DateTimeUpDown.Text></wpfx:DateTimeUpDown></DataTemplate></DataGridTemplateColumn.CellEditingTemplate></DataGridTemplateColumn><DataGridTemplateColumn Header="TIME" Width="*" IsReadOnly="True" x:Name="test"><DataGridTemplateColumn.CellTemplate><DataTemplate><TextBlock HorizontalAlignment="Right" ><TextBlock.Text><Binding Path="DURATION" Mode="TwoWay" UpdateSourceTrigger="PropertyChanged" /></TextBlock.Text></TextBlock></DataTemplate></DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn>
thanks Callum