Version

ConvertTextToValue Method

Converts the specified text to the value type using the ValueToTextConverterResolved. This method is typically called to convert the text modified by the user back to the ValueType.
Syntax
'Declaration
 
Public Function ConvertTextToValue( _
   ByVal text As String, _
   ByRef value As Object, _
   ByRef error As Exception _
) As Boolean
public bool ConvertTextToValue( 
   string text,
   out object value,
   out Exception error
)

Parameters

text
The text to convert.
value
This out parameter will be set to the converted value.
error
If conversion fails, error is set to a value that indicates the error.

Return Value

True if conversion succeeds, False otherwise.
Remarks

ConvertTextToValue is used to convert text into an object of type specified by ValueType property. This method is typically used to convert the user input in the form of text to the value that gets returned from the Value property. Value property returns objects of type specified by ValueType property.

For example, if the ValueType property of a XamTextEditor is set to DateTime type, and the user types in "1/1/07", this method will get called to convert that text value into a DateTime object.

Note: Typically there is no need for you to call this method directly as this method is automatically called by the ValueEditor itself to perform the necessary conversions between text and value.

Note: If you want to override the default conversion logic for converting between text and value, set the ValueToTextConverter and ValueToDisplayTextConverter properties.

Requirements

Target Platforms: Windows 10, Windows 8.1, Windows 8, Windows 7, Windows Server 2012, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also