HypernovaDesktop Components · docs
Binarymission
WPF › Skinning › BinarySkin

BinarySkin

class.NET 6 / 8 / 10.NET Framework 4.8Binarymission.WPF.Skinning

A skin: the colours controls are drawn in, each named for the place it is used, with the corner rounding and window effects that go with them.

public sealed class BinarySkin

Remarks

Start from a built-in skin with Create(BinarySkinTheme, Color), change what should differ, and put it in force with Apply. A skin can also be read from a file with Load(string). Validate reports any text that would be hard to read and any state change a user could not see, so a skin can be checked before it is shipped.

Members at a glance

BasedOnGets or sets the built-in skin this one was made from, which a skin file records so that it can be read back the same way.
CornerRadiusGets or sets how far the corners of buttons, menus and panels are rounded.
IsDarkGets or sets whether the skin is a dark one, so that Windows draws the window frame and backdrop dark to match.
ItemGets or sets one of the skin's colours.
NameGets or sets the name shown for the skin.
PrefersSystemBackdropGets or sets whether a window that can show the Windows backdrop (Mica, on Windows 11) behind its title should do so rather than fill it with Canvas.
RolesGets every colour a skin has, in the order a skin file lists them.
CloneMakes an independent copy, to change without changing this one.
CreateBrushA frozen brush in one of the skin's colours.
CreateBrushA frozen brush in a colour, for a control making its own colours from a skin's.
LooksTheSameAsWhether another skin draws exactly as this one does: the same colours, rounding and effects. The names need not match.
ToStringThe skin's name.
ValidateChecks that every piece of text in the skin reads on what it is drawn on, and that a user can see a command change under the pointer and when pressed.
MaximumCornerRadiusThe largest corner rounding a skin may ask for.

Properties

BasedOn

public BinarySkinTheme? BasedOn

Gets or sets the built-in skin this one was made from, which a skin file records so that it can be read back the same way.

Value. The built-in skin, or null when it was made from nothing.

CornerRadius

public double CornerRadius

Gets or sets how far the corners of buttons, menus and panels are rounded.

Value. From 0 (square) to MaximumCornerRadius; 4 by default.

ArgumentOutOfRangeException
The value is outside that range.

IsDark

public bool IsDark

Gets or sets whether the skin is a dark one, so that Windows draws the window frame and backdrop dark to match.

Value. true for a dark skin.

Item

public Color this[BinarySkinColor role]

Gets or sets one of the skin's colours.

Value. The colour.

role
Where the colour is used.
ArgumentOutOfRangeException
role is not a colour a skin has.

Name

public string Name

Gets or sets the name shown for the skin.

Value. The name. Never empty.

ArgumentException
The value is null or white space.

PrefersSystemBackdrop

public bool PrefersSystemBackdrop

Gets or sets whether a window that can show the Windows backdrop (Mica, on Windows 11) behind its title should do so rather than fill it with Canvas.

Value. true , the default, to let the backdrop show.

Roles

public static IList<BinarySkinColor> Roles

Gets every colour a skin has, in the order a skin file lists them.

Value. The roles.

Methods

Clone

public BinarySkin Clone()

Makes an independent copy, to change without changing this one.

Returns. The copy.

CreateBrush

public SolidColorBrush CreateBrush(BinarySkinColor role)

A frozen brush in one of the skin's colours.

role
The colour.

Returns. A new frozen brush.

CreateBrush

public static SolidColorBrush CreateBrush(Color color)

A frozen brush in a colour, for a control making its own colours from a skin's.

color
The colour.

Returns. A new frozen brush.

LooksTheSameAs

public bool LooksTheSameAs(BinarySkin other)

Whether another skin draws exactly as this one does: the same colours, rounding and effects. The names need not match.

other
The other skin.

Returns. true when nothing a user could see differs.

ToString

public override string ToString()

The skin's name.

Returns. The name.

Validate

public IList<BinarySkinProblem> Validate()

Checks that every piece of text in the skin reads on what it is drawn on, and that a user can see a command change under the pointer and when pressed.

Returns. What is wrong; empty when nothing is.

Fields

MaximumCornerRadius

public const double MaximumCornerRadius

The largest corner rounding a skin may ask for.