Class CountToVisibilityConverter
Converts an integer count to a bool indicating whether it is zero. Use IsZero as a static instance for inline XAML binding.
Implements
Inherited Members
Namespace: MOSAIC.Converters
Assembly: MOSAIC.dll
Syntax
public class CountToVisibilityConverter : IValueConverter
Examples
Hide an element when count is zero:
<Border IsVisible="{Binding SegmentCount,
Converter={x:Static converters:CountToVisibilityConverter.IsZero},
ConverterParameter=Invert}"/>
Show an element only when count is zero (no parameter):
<Border IsVisible="{Binding SegmentCount,
Converter={x:Static converters:CountToVisibilityConverter.IsZero}}"/>
Fields
IsZero
Singleton instance. Returns true when count is zero
(i.e. shows the empty-state element). Pass Invert as
ConverterParameter to reverse the logic.
Declaration
public static readonly CountToVisibilityConverter IsZero
Field Value
| Type | Description |
|---|---|
| CountToVisibilityConverter |
Methods
Convert(object?, Type, object?, CultureInfo)
Converts a value.
Declaration
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The value to convert. |
| Type | targetType | The type of the target. |
| object | parameter | A user-defined parameter. |
| CultureInfo | culture | The culture to use. |
Returns
| Type | Description |
|---|---|
| object | The converted value. |
Remarks
This method should not throw exceptions. If the value is not convertible, return a Avalonia.Data.BindingNotification in an error state. Any exceptions thrown will be treated as an application exception.
ConvertBack(object?, Type, object?, CultureInfo)
Converts a value.
Declaration
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
Parameters
| Type | Name | Description |
|---|---|---|
| object | value | The value to convert. |
| Type | targetType | The type of the target. |
| object | parameter | A user-defined parameter. |
| CultureInfo | culture | The culture to use. |
Returns
| Type | Description |
|---|---|
| object | The converted value. |
Remarks
This method should not throw exceptions. If the value is not convertible, return a Avalonia.Data.BindingNotification in an error state. Any exceptions thrown will be treated as an application exception.