WPF › Smart Navigator › SolidColorBrushToColorConverter
SolidColorBrushToColorConverter
class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Controls.ListControls
Gets the Color of a SolidColorBrush, for bindings that need a colour.
public class SolidColorBrushToColorConverter : IValueConverter
Inherits from / implements: IValueConverter
Examples
<Window.Resources>
<nav:SolidColorBrushToColorConverter x:Key="ToColour" />
</Window.Resources>
<Border.Effect>
<DropShadowEffect Color="{Binding NavigationButtonNormalBorder, ElementName=recentReports, Converter={StaticResource ToColour}}" />
</Border.Effect>Members at a glance
| Methods | |
|---|---|
Convert | Returns the colour of a solid colour brush. |
ConvertBack | Not supported: the conversion works one way only, from brush to colour. |
Methods
Convert
public object Convert(object o, Type type, object parameter, 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;
DependencyProperty.UnsetValue
for null or any other kind of brush, so the target keeps its default.
ConvertBack
public object ConvertBack(object o, Type type, object parameter, 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.