Szerkesztés

Megosztás a következőn keresztül:


Binding.Converter Property

Definition

Gets or sets the converter to use.

public:
 property System::Windows::Data::IValueConverter ^ Converter { System::Windows::Data::IValueConverter ^ get(); void set(System::Windows::Data::IValueConverter ^ value); };
public System.Windows.Data.IValueConverter Converter { get; set; }
member this.Converter : System.Windows.Data.IValueConverter with get, set
Public Property Converter As IValueConverter

Property Value

A value of type IValueConverter. The default is null.

Remarks

A binding implicitly uses a default converter that tries to do a type conversion between the source value and the target value. If a conversion cannot be made, the default converter returns null.

If you want to associate a custom value converter with a binding, you should create a class that implements the IValueConverter interface and supply implementations for the Convert and ConvertBack methods. Value converters can change data from one type to another, translate between cultural details such as character sets, or modify other aspects of their presentation. For examples of typical conversion scenarios, see "Data Conversion" in the Data Binding Overview.

XAML Attribute Usage

<object Converter="myConverter"/>

XAML Values

myConverter A resource reference to a class that implements the IValueConverter interface, which includes implementations of the Convert and ConvertBack methods. To refer to a value converter, use the StaticResource Markup Extension.

Applies to