Xamarin.Forms Guides | Samples

Xamarin.Forms.BindingBase.StringFormat Property

Gets or sets the string format for this binding.

Syntax

public String StringFormat { get; set; }

See Also

Value

A string specifying the format for the value of this binding.

Remarks

Used for providing a display format for the binding value or compositing the value with other text. Implementors of BindingBase decide how the string format is utilized, but all support standard String.Format conventions.

Binding allows for one argument for its singular value.

A simple example showing compositing text and determining the display format for the value with a Binding

Example

Label label = new Label();
label.AddBinding (new Binding (Label.TextProperty, "Price") {
  StringFormat = "Price: {0:C2}"
});

Requirements

Namespace: Xamarin.Forms
Assembly: Xamarin.Forms.Core (in Xamarin.Forms.Core.dll)
Assembly Versions: 1.0.0.0, 1.1.0.0, 1.2.0.0, 1.3.0.0, 1.4.0.0, 1.5.0.0, 2.0.0.0