ComponentOne Grid for WPF: Data Validation > Inputting Data > Changing the Source Value

Changing the Source Value

The second stage of the source value update – setting the source value to the value of the ItemCell.Value property – can only be started if there are no reported errors in the first stage (that is, ErrorInfo.HasError is False). The process can be started explicitly by calling the EndEdit method (or the EndEdit method, which calls EndEdit) or implicitly by the action an end user takes such as selecting another cell or pressing the ENTER key.

The stage includes two steps: assigning ItemCell.Value to a source property and leaving edit mode.

Step 1: Assigning ItemCell.Value to a source property

The value of the ItemCell.Value property is assigned to a source property. If the source property raised an exception, the process is stopped and an error is reported in the ErrorInfo property, whose sub-properties are set as following:

 

ErrorInfo property

Value or value source

HasError

True

ErrorContent

Exception.Message

ErrorException

Exception raised by the source property.

MustFixError

True

IsDataSourceError

True

Step 2: Leaving edit mode

If step 1 has succeeded, the cell leaves edit mode, that is, the IsEdit property value becomes False. If the source item supports the IDataErrorInfo interface, the grid attempts to retrieve errors for the source property via this interface. If an error has been returned for the property, the error is reflected in the ErrorInfo property, with sub-properties set as following:

 

ErrorInfo property

Value or value source

HasError

True

ErrorContent

IDataErrorInfo.Item[property_name]

ErrorException

Null

MustFixError

False

IsDataSourceError

True

 

Note that you can set the grid so that changes are committed to the underlying data source before the user leaves the cell edit mode. For details, see Committing Data to a Data Source.


Send comments about this topic to ComponentOne.
Copyright © 1987-2010 ComponentOne LLC. All rights reserved.