HypernovaDesktop Components · docs
Binarymission
WPF › Smart Info Panel › SolidColorBrushToColorConverter

SolidColorBrushToColorConverter

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Controls.Containers

Gets the Color of a SolidColorBrush in a binding – for binding one of the panel's colour properties, such as SmartInfoPanel.BorderDropShadowColor, to a brush.

public class SolidColorBrushToColorConverter : IValueConverter

Inherits from / implements: IValueConverter

Examples

<Window.Resources>
    <info:SolidColorBrushToColorConverter x:Key="ToColour" />
</Window.Resources>

<info:SmartInfoPanel BorderBrush="SteelBlue" IsBorderDropShadowEnabled="True"
                     BorderDropShadowColor="{Binding BorderBrush, RelativeSource={RelativeSource Self}, Converter={StaticResource ToColour}}" />

Members at a glance

Methods
ConvertReturns the colour of a solid colour brush.
ConvertBackNot supported: the conversion works one way only, from brush to colour.

Methods

Convert

public object Convert(object o, Type type, object parameter, System.Globalization.CultureInfo culture)

Returns the colour of a solid colour brush.

Parameters
o
The value from the binding, expected to be a SolidColorBrush.
type
The type the binding target expects; not used.
parameter
Not used.
culture
Not used.
Returns

The brush's SolidColorBrush.Color; null for null or any other kind of brush, which a Color target cannot take, so the binding leaves it at its default.

ConvertBack

public object ConvertBack(object o, Type type, object parameter, System.Globalization.CultureInfo culture)

Not supported: the conversion works one way only, from brush to colour.

Parameters
o
Not used.
type
Not used.
parameter
Not used.
culture
Not used.
Returns

Never returns.

Exceptions
NotSupportedException
Always.