バージョン

DefaultValueToDisplayTextConverter プロパティ (TextEditorBase)

値とテキスト間で変換するために使用されるデフォルト コンバーターを返します。
シンタックス
'宣言
 
Protected Overridable ReadOnly Property DefaultValueToDisplayTextConverter As IValueConverter
protected virtual IValueConverter DefaultValueToDisplayTextConverter {get;}
使用例
public class MyPointConverter : IValueConverter
{
	// Convert gets called to convert value to text.
	public object Convert( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
	{
		ValueEditor editor = parameter as ValueEditor;
		if ( value is Point && targetType == typeof( string ) )
			value.ToString( );

		return Infragistics.Windows.Utilities.ConvertDataValue( value, targetType, editor.FormatProvider, editor.Format );
	}

	// ConvertBack gets called to convert user input into to value.
	public object ConvertBack( object value, Type targetType, object parameter, System.Globalization.CultureInfo culture )
	{
		string text = null != value ? value.ToString( ) : string.Empty;

		return Point.Parse( text );
	}
}
<igEditors:XamTextEditor x:Name="pointEditor" 
                                             
ValueType="{x:Type Point}"
                                             
>

    
<!--ValueToTextConverter gets used when in edit mode to convert value to
    text and text (user input) into value.
-->
    
<igEditors:XamTextEditor.ValueToTextConverter>
        
<local:MyPointConverter />
    
</igEditors:XamTextEditor.ValueToTextConverter>

    
<!--You can specify a different converter for display mode which gets
    used when not in edit mode. This converter only gets used for converting
    value to text.
-->
    
<igEditors:XamTextEditor.ValueToDisplayTextConverter>
        
<local:MyPointConverter />
    
</igEditors:XamTextEditor.ValueToDisplayTextConverter>
            
</igEditors:XamTextEditor>
Public Class MyPointConverter
    Implements IValueConverter

    ' Convert gets called to convert value to text.
    Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.Convert
        Dim editor As ValueEditor = DirectCast(parameter, ValueEditor)
        If TypeOf value Is Point AndAlso targetType Is GetType(String) Then
            value.ToString()
        End If

        Return Infragistics.Windows.Utilities.ConvertDataValue(value, targetType, editor.FormatProvider, editor.Format)
    End Function

    ' ConvertBack gets called to convert user input into to value.
    Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As System.Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
        Dim text As String = String.Empty
        If Not Nothing Is value Then
            text = value.ToString()
        End If

        Return Point.Parse(text)
    End Function
End Class
参照