Version

ConvertValueToText Method

Converts the specified value to text using the ValueToTextConverterResolved. This method is used to display the value of the editor when the editor is in edit mode.
Syntax
'Declaration
 
Public Function ConvertValueToText( _
   ByVal value As Object, _
   ByRef text As String, _
   ByRef error As Exception _
) As Boolean
public bool ConvertValueToText( 
   object value,
   out string text,
   out Exception error
)

Parameters

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

Return Value

True if conversion succeeds, False otherwise.
Remarks

ConvertValueToText is used to convert value to text. This method is typically used to convert the value of the editor (as specified by the Value property) into text that the user can edit when the editor enters edit mode. When not in edit mode, TextInputBase.ConvertValueToDisplayText method is used to convert value to text that gets displayed in the editor. The Text property's return value corresponds to the text that this method converts where as the DisplayText property's return value corresponds to the text that ConvertValueToDisplayText method converts.

Note that DisplayText and ConvertValueToDisplayText methods are defined on TextInputBase class. This is because display text conversions are only applicable for text based editors, all of which derive from TextInputBase.

As an example, the ValueType property of a XamMaskedInput is set to DateTime type, and the Value property is set to a "01/01/2007" DateTime instance. This method gets called to convert that DateTime value to a string when the user enters edit mode. When the editor is not in edit mode, TextInputBase.ConvertValueToDisplayText is used. The difference between this method and ConvertValueToDisplayText is that the ConvertValueToDisplayText will take into account FormatProvider and Format property settings where as ConvertValueToText will not.

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

Note: If you want to override the default conversion logic for converting between value and text, 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