Skip to content

Commit cb98645

Browse files
ES-976509 - Resolved the ReadMe file changes in the sample repository
1 parent 5d4f9d8 commit cb98645

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

README.md

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
1-
# How to move selection to record when add the new row in SfDataGrid contains empty record in WPF DataGrid (SfDataGrid)?
1+
# How to Move Selection to Record when Add the New Row Contains Empty Record in WPF DataGrid?
22

3-
## About the sample
3+
This sample illustrates that how to move selection to record when add the new row contains empty record in [WPF DataGrid](https://www.syncfusion.com/wpf-controls/datagrid) (SfDataGrid).
44

5-
This sample illustrates that how to move selection to record when add the new row in SfDataGrid contains empty record in [WPF DataGrid](https://www.syncfusion.com/wpf-ui-controls/datagrid) (SfDataGrid).
6-
7-
The current cell will remain in the AddNewRow after adding a record when the grid has no records in [WPF DataGrid](https://www.syncfusion.com/wpf-ui-controls/datagrid) (SfDataGrid). But, you can move the current cell to the newly added record by moving the current cell in [SfDataGrid.RowValidated](https://help.syncfusion.com/cr/cref_files/wpf/Syncfusion.SfGrid.WPF~Syncfusion.UI.Xaml.Grid.SfDataGrid~RowValidated_EV.html) event using the ScrollInView() method. You can also change the AddNewRow state to the normal using [VisualStateManager.GoToState()](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.visualstatemanager.gotostate?view=winrt-19041) method.
5+
The current cell will remain in the AddNewRow after adding a record when the grid has no records in `DataGrid`. But, you can move the current cell to the newly added record by moving the current cell in [SfDataGrid.RowValidated](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Grid.SfDataGrid.html#Syncfusion_UI_Xaml_Grid_SfDataGrid_RowValidated) event using the ScrollInView() method. You can also change the AddNewRow state to the normal using [VisualStateManager.GoToState()](https://docs.microsoft.com/en-us/uwp/api/windows.ui.xaml.visualstatemanager.gotostate?view=winrt-19041) method.
86

97
```C#
108
//Event subscription
@@ -13,11 +11,9 @@ this.datagrid.RowValidated += sfdatagrid_RowValidated;
1311
//Event customization.
1412
private void sfdatagrid_RowValidated(object sender, RowValidatedEventArgs e)
1513
{
16-
1714
var addNewRow = this.datagrid.RowGenerator.Items.FirstOrDefault(item => item.RowType == RowType.AddNewRow);
1815
if (datagrid.IsAddNewIndex(e.RowIndex))
1916
{
20-
2117
datagrid.Dispatcher.BeginInvoke(new Action(() =>
2218
{
2319
datagrid.SelectedItem = e.RowData;
@@ -27,16 +23,8 @@ private void sfdatagrid_RowValidated(object sender, RowValidatedEventArgs e)
2723
//To change the AddNewRow state.
2824
VisualStateManager.GoToState(addNewRow.Element, "Normal", usetransition);
2925
usetransition = false;
30-
3126
}));
3227
}
3328
}
3429
```
35-
![CurrentCellAddNewRow](CurrentCellAddNewRow.png)
36-
37-
KB article - [How to move selection to record when add the new row in SfDataGrid contains empty record in WPF DataGrid (SfDataGrid)?](https://www.syncfusion.com/kb/11768/how-to-move-selection-to-record-when-add-the-new-row-in-sfdatagrid-contains-empty-record-in)
38-
39-
## Requirements to run the demo
40-
Visual Studio 2015 and above versions
41-
42-
30+
![DataGrid with new row added](RowAddedUsingAddNewRow.png)

0 commit comments

Comments
 (0)