An implementation of IValueConverter that converts from one set of values to another based on the contents of the Mappings collection.

Namespace: DevZest.Windows
Assembly: DevZest.WpfDocking (in DevZest.WpfDocking.dll)


[ValueConversionAttribute(typeof(Object), typeof(Object))]
public class MapConverter : DependencyObject, 
Visual Basic
<ValueConversionAttribute(GetType(Object), GetType(Object))> _
<ContentPropertyAttribute("Mappings")> _
Public Class MapConverter _
	Inherits DependencyObject _
	Implements IValueConverter


The MapConverter converts from one set of values to another. The source and destination values are stored in instances of Mapping inside the Mappings collection.

If this converter is asked to convert a value for which it has no knowledge, it will use the FallbackBehavior to determine how to deal with the situation.


The following example shows a MapConverter being used to control the visibility of a Label based on a CheckBox:
<CheckBox x:Name="_checkBox"/>
<Label Content="Here is the label.">
        <Binding Path="IsChecked" ElementName="_checkBox" FallbackValue="Collapsed">
                    <Mapping To="{x:Static Visibility.Visible}">


The following example shows how a MapConverter can be used to convert between values of the UriFormat enumeration and human-readable strings. Notice how not all possible values are present in the mappings. The fallback behavior is set to ReturnOriginalValue to ensure that any conversion failures result in the original value being returned:
        <Binding Path="UriFormat">
                <MapConverter FallbackBehavior="ReturnOriginalValue">
                    <Mapping From="{x:Static sys:UriFormat.SafeUnescaped}" To="Safe unescaped"/>
                    <Mapping From="{x:Static sys:UriFormat.UriEscaped}" To="URI escaped"/>

Inheritance Hierarchy

See Also