|
<syncfusion:SfDataGrid x:Name="myGrid"
AllowEditing="True"
NavigationMode="Cell"
ItemsSource="{Binding mycollect}"
SelectionMode="Single"
ColumnSizer="Star" CurrentCellEndEdit="myGrid_CurrentCellEndEdit"
AutoGenerateColumns="False">
<syncfusion:SfDataGrid.Columns>
<syncfusion:GridTextColumn MappingName="Text" AllowEditing="False"></syncfusion:GridTextColumn>
<syncfusion:GridTextColumn MappingName="No_1" AllowEditing="False"></syncfusion:GridTextColumn>
<syncfusion:GridNumericColumn MappingName="No_2"></syncfusion:GridNumericColumn>
</syncfusion:SfDataGrid.Columns>
</syncfusion:SfDataGrid>
…… private void myGrid_CurrentCellEndEdit(object sender, GridCurrentCellEndEditEventArgs e) {
myGrid.BeginEdit(myGrid.CurrentCellManager.RowColumnIndex.RowIndex + 1, myGrid.CurrentCellManager.RowColumnIndex.ColumnIndex);
} |
Hi Tayyip,
By using the BeginEdit method, we can go to the next row when the current cell editing is finished on CurrentCellEndEdit event of SfDataGrid. Please refer the below code snippet.
Code snippet :
<syncfusion:SfDataGrid x:Name="myGrid"AllowEditing="True"NavigationMode="Cell"ItemsSource="{Binding mycollect}"SelectionMode="Single"ColumnSizer="Star" CurrentCellEndEdit="myGrid_CurrentCellEndEdit"AutoGenerateColumns="False"><syncfusion:SfDataGrid.Columns><syncfusion:GridTextColumn MappingName="Text" AllowEditing="False"></syncfusion:GridTextColumn><syncfusion:GridTextColumn MappingName="No_1" AllowEditing="False"></syncfusion:GridTextColumn><syncfusion:GridNumericColumn MappingName="No_2"></syncfusion:GridNumericColumn></syncfusion:SfDataGrid.Columns></syncfusion:SfDataGrid>
……
private void myGrid_CurrentCellEndEdit(object sender, GridCurrentCellEndEditEventArgs e){myGrid.BeginEdit(myGrid.CurrentCellManager.RowColumnIndex.RowIndex + 1, myGrid.CurrentCellManager.RowColumnIndex.ColumnIndex);}
Regards,
Karthik Raja
Hi Tayyip,
We didn’t handle the keyboard in our source. So, we need time to validate your requirement. So, we update further details on or before 23rd September 2020. We appreciate your patience until then.
Regards,
Karthik Raja
Hi Tayyip,
We need some more time to work on this. So, we will update the details on or
before 25th September 2020. We appreciate your patience until then.
Regards,
Karthik Raja
Hi Tayyip,
We need some more time to work on this. So, we will update the details on or before 25th September 2020. We appreciate your patience until then.
Regards,
Karthik Raja
|
……
this.myGrid.CellRenderers.Remove("Numeric"); this.myGrid.CellRenderers.Add("Numeric", new CustomNumericRenderer());
….. private async void myGrid_CurrentCellEndEdit(object sender, GridCurrentCellEndEditEventArgs e) {
await Task.Delay(100);
myGrid.BeginEdit(myGrid.CurrentCellManager.RowColumnIndex.RowIndex + 1, myGrid.CurrentCellManager.RowColumnIndex.ColumnIndex);
}
… public class CustomNumericRenderer : GridCellNumericRenderer {
public CustomNumericRenderer()
{
}
protected override SfNumericTextBoxExt OnCreateEditUIView()
{
var view = new NumericTextBox(this.DataGrid);
return view;
}
}
public class NumericTextBox : SfNumericTextBoxExt
{
SfDataGrid dataGrid;
/// <summary>
/// Initializes a new instance of the <see cref="NumericTextBoxView"/> class.
/// </summary>
public NumericTextBox(SfDataGrid sfDataGrid)
{
dataGrid = sfDataGrid;
this.Completed += NumericTextBox_Completed;
}
private void NumericTextBox_Completed(object sender, EventArgs e)
{
dataGrid.EndEdit();
}
} |
Hi Tayyip,
Sorry for the miscommunication,
We can hook the Completed event of GridNumericColumn by writing the custom class for GridNumericColumn. For more details please refer to the below code example and attached sample.
……
this.myGrid.CellRenderers.Remove("Numeric");this.myGrid.CellRenderers.Add("Numeric", new CustomNumericRenderer());
…..
private async void myGrid_CurrentCellEndEdit(object sender, GridCurrentCellEndEditEventArgs e){await Task.Delay(100);myGrid.BeginEdit(myGrid.CurrentCellManager.RowColumnIndex.RowIndex + 1, myGrid.CurrentCellManager.RowColumnIndex.ColumnIndex);}
…
public class CustomNumericRenderer : GridCellNumericRenderer{public CustomNumericRenderer(){}protected override SfNumericTextBoxExt OnCreateEditUIView(){var view = new NumericTextBox(this.DataGrid);return view;}}public class NumericTextBox : SfNumericTextBoxExt{SfDataGrid dataGrid;/// <summary>/// Initializes a new instance of the <see cref="NumericTextBoxView"/> class./// </summary>public NumericTextBox(SfDataGrid sfDataGrid){dataGrid = sfDataGrid;this.Completed += NumericTextBox_Completed;}private void NumericTextBox_Completed(object sender, EventArgs e){dataGrid.EndEdit();}}
Sample link : https://www.syncfusion.com/downloads/support/directtrac/general/ze/DataGridDemo2105544065.zip
Regards,
Karthik Raja