Share via


DefaultStringConverter Class

Definition

Converts the value of the single Binding in a MultiBinding to a string, and returns that string if not null/empty, otherwise returns DefaultValue. The MultiBinding must have exactly one Binding.

public ref class DefaultStringConverter : System::Windows::Data::IMultiValueConverter
public class DefaultStringConverter : System.Windows.Data.IMultiValueConverter
type DefaultStringConverter = class
    interface IMultiValueConverter
Public Class DefaultStringConverter
Implements IMultiValueConverter
Inheritance
DefaultStringConverter
Implements

Remarks

The problem solved by this IMultiValueConverter is that for an ordinary Binding which is bound to "Path=PropertyA.PropertyB", the Converter is not called if the value of PropertyA was null (and therefore PropertyB could not be accessed). By contrast, the converter for an IMultiValueConverter will be called even if any or all of the bindings fail to evaluate down to the last property.

Note that the MultiBinding which uses this IMultiValueConverter must have exactly one Binding.

Constructors

DefaultStringConverter()

Properties

DefaultValue

Gets or sets default string returned by the converter if the value is null/empty.

Methods

Convert(Object[], Type, Object, CultureInfo)

Converts the value of the single Binding in the IMultiValueConverter to a string, and returns that string if not null/empty, otherwise returns DefaultValue.

ConvertBack(Object, Type[], Object, CultureInfo)

Skip ConvertBack binding.

Applies to