共用方式為


Add Value Converter dialog box

A value converter allows data to be modified as it passes through the data binding engine. You can create value converters by implementing the IValueConverter interface in your code. Once a value converter is created, you can select the value converter in the XAML Designer when you configure a data binding.

When you create a data binding, you can either select a converter in the Converter drop-down list in the Create Data Binding dialog box, if one has already been added, or you can select <Add value converter> to add a new one. For more info on creating a data binding in XAML Designer, see How to bind data in XAML Designer.

If you select <Add value converter> in the Create Data Binding dialog box, the Add Value Converter dialog box appears. In this dialog box, you can select a value converter from the list of value converters.

The following illustration shows the Add Value Converter dialog box with a value converter named DateFormatter selected.

Add Value Converter Dialog Box

Note

Once you add or select a converter, you can specify an optional parameter in the ConverterParameter text box in the Create Data Binding dialog box. This parameter is an object that can be used in the converter logic and corresponds to the parameter argument in the Convert method.

See Also

Concepts

Creating a UI by using XAML Designer