Table of Contents

Class HexBrushConverter

Namespace
McServerLauncher.ViewModels
Assembly
McServerLauncher.dll

A hex string to a brush, for the live preview beside each colour box in the settings.

public class HexBrushConverter : IValueConverter
Inheritance
HexBrushConverter
Implements
IValueConverter
Inherited Members

Remarks

A converter rather than four properties on the dialog, following NoticeBrushConverter: the preview has to update on every keystroke, and a binding straight to the same string the box edits is what gives that for free. Anything unparseable — which is most of what a half-typed colour looks like — shows as transparent rather than throwing or freezing on the last good value, so the box visibly goes blank until the colour is complete.

Fields

Instance

public static readonly HexBrushConverter Instance

Field Value

HexBrushConverter

Methods

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

Converts a value.

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

Parameters

value object

The value to convert.

targetType Type

The type of the target.

parameter object

A user-defined parameter.

culture CultureInfo

The culture to use.

Returns

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.

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

Parameters

value object

The value to convert.

targetType Type

The type of the target.

parameter object

A user-defined parameter.

culture CultureInfo

The culture to use.

Returns

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.