Format Property

Specifies format used for converting between value and text.
Public Property Format As String
public string Format {get; set;}
See FormatProvider property for more information.
The following code sets Format of a XamTextEditor to "C" and FormatProvider to a CultureInfo instance. Note that the ValueType is set to Decimal. Formats are specific to type. So make sure the format that you set matches the value type of the editor. The text editor will display the value 10 formatted with currency format of the set format provider. Also any new values entered in the editor will be automatically formatted upon leaving the editor control.

<!--This code defines a XamTextEditor. C#/VB code snippets set the Format and FormatProvider properties-->
<igEditors:XamTextEditor x:Name="textEditor1"  />
Protected Overrides Sub OnInitialized(ByVal e As EventArgs)


    Me.textEditor1.ValueType = GetType(Decimal)
    Me.textEditor1.Format = "C"
    Me.textEditor1.FormatProvider = New System.Globalization.CultureInfo("fr-FR")
    Me.textEditor1.Value = 10
    Debug.WriteLine("Text = " & Me.textEditor1.DisplayText)
End Sub
protected override void OnInitialized( EventArgs e )
	base.OnInitialized( e );

	this.textEditor1.ValueType = typeof( Decimal );
	this.textEditor1.Format = "C";
	this.textEditor1.FormatProvider = new System.Globalization.CultureInfo( "fr-FR" );
	this.textEditor1.Value = 10;
	Debug.WriteLine( "Text = " + this.textEditor1.DisplayText );

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