How to read cell value in edit mode in UWP Spreadsheet (SfSpreadsheet)?
UWP Spreadsheet (SfSpreadsheet) provides support to read the cell value while the cell is in edit mode.
You can get the value of current cell in edit mode by hooking CurrentCellValueChanged event and accessing the value from ControlText property.
The CurrentCellValueChanged event will be triggered when entering each and every character into the cell.
Spreadsheet.ActiveGrid.CurrentCellValueChanged += ActiveGrid_CurrentCellValueChanged;
private void ActiveGrid_CurrentCellValueChanged(object sender,CurrentCellValueChangedEventArgs args)
{
// Gets the text of cell in edit mode
var cellvalue = args.ControlText;
}You can also get the value of edited cell by using CurrentCellValidating event. For this, you need to call the Validate method of SpreadsheetCurrentCell.
//This call will trigger the CurrentCellValidating event.
Spreadsheet.ActiveGrid.CurrentCell.Validate(out isValid);
Spreadsheet.ActiveGrid.CurrentCellValidating += ActiveGrid_CurrentCellValidating;
private void ActiveGrid_CurrentCellValidating(object sender,CurrentCellValidatingEventArgs args)
{
//Gets the value of cell in edit mode
var cellvalue = args.NewValue;
}
bool isValid = true;Conclusion
I hope you enjoyed learning on how to read the cell value while the cell is still in edit mode in UWP SfSpreadsheet.
You can refer to our UWP SfSpreadsheet feature tour page to know about its other groundbreaking feature representations. You can also explore our documentation to understand how to present and manipulate data.
For current customers, you can check out our WinForms components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in comments below. You can also contact us through our support forums, Direct-Trac, or feedback portal. We are always happy to assist you!