Show / Hide Table of Contents

Class ConvertNullToUnsetValue

This converter will return DependencyProperty.UnsetValue if the input value is null. This is needed to work around an issue with PriorityBindings. If the first Binding in a PriorityBinding has a null value, then the binding might still succeed if the Path="." (for example, if the target property is a string then null is a valid value). In this scenario, setting the TargetNullValue="DependencyProperty.UnsetValue" doesn't work. For example, this will use the first Binding if the value of the source is null: PriorityBinding Binding Path="." TargetNullValue="{x:Static DependencyProperty.UnsetValue}" Binding Path="PropertyB" /PriorityBinding The expected result is that the second binding would be used if the source value is null. Using this converter to convert null values into DependencyProperty.UnsetValue works around the problem.

Inheritance
object
ConvertNullToUnsetValue
Implements
IValueConverter
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: Phoenix.Aruba.Converters
Assembly: Phoenix.Plugin.Aruba.dll
Syntax
public class ConvertNullToUnsetValue : IValueConverter

Methods

View Source

Convert(object, Type, object, CultureInfo)

Converts a given input value to DependencyProperty.UnsetValue if it is null. It passes it through unchanged if it is not null.

Declaration
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
Parameters
Type Name Description
object value

The input value to be converted.

Type targetType

The parameter is not used.

object parameter

The parameter is not used.

CultureInfo culture

The parameter is not used.

Returns
Type Description
object

DependencyProperty.UnsetValue if the input value is null. Otherwise it returns the input value unchanged.

View Source

ConvertBack(object, Type, object, CultureInfo)

The method is not used.

Declaration
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
Parameters
Type Name Description
object value

The parameter is not used.

Type targetType

The parameter is not used.

object parameter

The parameter is not used.

CultureInfo culture

The parameter is not used.

Returns
Type Description
object

The return value is not used.

Implements

IValueConverter
  • View Source
In this article
Back to top Generated by DocFX