Namespace MOSAIC.Converters

Classes

BlockCategoryToBrushConverter

Maps a BlockCategory to its themed category brush from MosaicColors — the same palette the block cards use — so the palette's colour stripes/dots stay consistent with the rest of the UI. Resolves named brushes rather than hardcoding hex (per the design system).

BoolToColorConverter

Converts boolean to color for various UI elements.

BoolToColorConverterTrigger

Converts bool to color. Parameter format: "TrueColor|FalseColor" (hex colors) Example: ConverterParameter="#FF0000|#00FF00"

BoolToConnectTextConverter

BoolToDoubleConverter

Converts a bool to one of two double values. Used in AXAML to bind IsBipolar → ProgressBar Minimum.

BoolToOpacityConverter

Converts boolean to opacity (1.0 or 0.4).

BoolToStatusColorConverter

Maps a bool to a themed status brush, resolved from the active theme: true → StatusNormalBrush (green), false → StatusErrorBrush (red). Pass a resource key as ConverterParameter to override the false brush (e.g. ThemeBorderBrush for a neutral/inactive state).

BoolToStreamTextConverter

Converts a boolean (IsStreaming) to button text: false → "Stream", true → "Stop".

BoolToStringConverter

Converts a bool to one of two strings.

BooleanInverseConverter

BooleanToStringConverter

CountToVisibilityConverter

Converts an integer count to a bool indicating whether it is zero. Use IsZero as a static instance for inline XAML binding.

EnumToBoolConverter

Converts an enum value to true when it equals the converter parameter (the parameter is a string parsed against the bound enum's type). The reverse direction returns the parsed enum value when fed true, and Avalonia.Data.BindingOperations.DoNothing otherwise — which is what makes a group of RadioButtons correctly act as a single-selection over an enum-valued property:

IsChecked="{Binding Source, Mode=TwoWay,
                    Converter={x:Static converters:EnumToBoolConverter.Instance},
                    ConverterParameter=Manual}"

Each radio's IsChecked turns into "Source == Manual"; flipping a radio on emits "Manual" back into the binding, which selects that radio and deselects the others (because the others now bind to false).

FileNameConverter

Shows a path as just its file name, leaving the bound value itself untouched.

LogLevelToColorConverter

Maps a LogLevel to a themed status brush (or its colour, for targets that expect a Avalonia.Media.Color), so the log panel's severity dot uses the same four tokens as every other status indicator in the app.

RunningToImageConverter

StatusTextToColorConverter

Maps a free-form device/pipeline status to a themed status brush, by keyword. Accepts either a status STRING (e.g. "Idle", "Streaming", "Disconnected", "Waiting for probe...") or a status ENUM (its name is used — e.g. HannesHand's DeviceStatus.Ready/DongleReady/Error). Use for status badges whose source is not the BlockStatus enum (which has StatusToColorConverter). Order matters: error keywords are checked first, then the transient/amber set before the green set so "Disconnected", "Connecting" and "DongleReady" do not read as a healthy connection.

StatusToBoolConverter

StatusToColorConverter

Maps a BlockStatus to a themed status brush (or its colour, for targets that expect a Avalonia.Media.Color). Resolves the shared status tokens from MosaicColors so the palette lives in one place. Every enum value is mapped — no status falls through to a transparent / invisible badge.

StatusToVisConverter

StreamButtonConverter

Converts a boolean IsStreaming value to the toggle button label.

StringToBrushConverter

Converts a hex color string (e.g. "#FF4136") to an Avalonia Avalonia.Media.SolidColorBrush. Used for scope legend dots that need to match trace colors.

TrainingToColorConverter

Converts training state to appropriate button color.

WidthToBoolConverter

Returns true when the width (or Size) is less than the specified Breakpoint. Useful for responsive “IsNarrow” bindings in Avalonia.

Search documentation

Start typing to search the documentation.