Table of Contents

Class VisibilityConverter

Namespace
Tudormobile.IronLedgerLib.UI.Wpf.Converters
Assembly
Tudormobile.IronLedgerLib.UI.Wpf.dll

Converts a value to a Visibility based on whether the value is considered "present" (visible) or "absent" (non-visible).

public class VisibilityConverter : IValueConverter
Inheritance
VisibilityConverter
Implements
Inherited Members

Remarks

The following rules determine whether a value is visible:

  • null → non-visible.
  • A value type equal to its default (e.g. 0, false) → non-visible.
  • A string that is null, empty, or whitespace → non-visible.
  • All other values → visible.

An optional Visibility converter parameter controls output behavior:

The parameter may be a Visibility value or a case-insensitive string equivalent (e.g. "Visible", "Hidden"), which is the natural form when set via a XAML ConverterParameter attribute.

Constructors

VisibilityConverter()

public VisibilityConverter()

Methods

Convert(object?, Type, object?, CultureInfo)

Converts a value to a Visibility.

public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)

Parameters

value object

The value to evaluate.

targetType Type

The target binding type. This converter always returns Visibility and does not use this parameter; null is accepted.

parameter object

An optional Visibility value, or its case-insensitive string equivalent (e.g. "Visible", "Hidden"), that controls the non-visible state or inverts the result.

culture CultureInfo

The culture to use (unused).

Returns

object

A Visibility value.

ConvertBack(object?, Type, object?, CultureInfo)

Not supported. Always throws NotImplementedException.

public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)

Parameters

value object
targetType Type
parameter object
culture CultureInfo

Returns

object