HypernovaDesktop Components · docs
Binarymission
WPF › Skinning

Skinning

.NET Framework 4.8.NET 6 / 8 / 10v2.0.0WPF

The keys BinarySkinManager publishes the skin in force under, in the application's resources, for a window, a style or a control of your own to draw with.

12public types
102public members
1namespaces

Assembly

AssemblyBinarymission.WPF.Skinning.dll
Root namespaceBinarymission.WPF.Skinning
Target frameworks.NET Framework 4.8, .NET 6 / 8 / 10

Overview

Refer to them with DynamicResource, so that a change of skin reaches what uses them. Each colour is published twice: as a frozen SolidColorBrush under Brush (or the named property, such as SurfaceBrush, which XAML can reach), and as a Color under Color, for gradients and effects.

While no skin is in force the keys are not published, and a property that refers to one keeps its own default; give it a fallback in a style if that matters.

Getting started

<Border xmlns:skin="clr-namespace:Binarymission.WPF.Skinning;assembly=Binarymission.WPF.Skinning"
        Background="{DynamicResource {x:Static skin:BinarySkinKeys.SurfaceBrush}}"
        BorderBrush="{DynamicResource {x:Static skin:BinarySkinKeys.StrokeBrush}}"
        CornerRadius="{DynamicResource {x:Static skin:BinarySkinKeys.CornerRadius}}"
        BorderThickness="1" Padding="12">
    <TextBlock Text="Order summary"
               Foreground="{DynamicResource {x:Static skin:BinarySkinKeys.SurfaceTextBrush}}" />
</Border>

API reference

Binarymission.WPF.Skinning

class BinarySkinA skin: the colours the Binarymission controls are drawn in, each named for the place it is used, with the corner rounding and window effects that go with them.
enum BinarySkinColorThe colours a BinarySkin is made of. Each one names the place it is used, not a hue, so that a control asks for "the text on a surface" and gets whatever the skin in force says that is.
enum BinarySkinDensityLists how closely the controls that follow BinarySkinManager pack their commands.
class BinarySkinFormatExceptionThe exception thrown for a skin file that is not JSON, or is JSON that does not describe a skin. The message names the line and column of the mistake.
class BinarySkinKeysThe keys BinarySkinManager publishes the skin in force under, in the application's resources, for a window, a style or a control of your own to draw with.
class BinarySkinManagerHolds the skin in force for the whole application, publishes it in the application's resources under BinarySkinKeys, and says when it changes.
class BinarySkinProblemDescribes two colours of a skin that are too alike: text that would be hard to read, or a change of state a user could not see. Validate returns these.
class BinarySkinSerializerReads and writes skins as JSON files, so that a skin can be shipped with an application, chosen by a user or edited by hand.
enum BinarySkinThemeLists the skins built into the library, which Create(BinarySkinTheme) makes and a skin file names as the one it starts from.
class BinarySkinsMakes the built-in skins: the flat look of the current Office applications in four themes, in any accent colour.
class ColorContrastMeasures how well one colour reads on another, and moves a colour just far enough to read - the arithmetic the built-in skins are made with, for a skin or a control of your own.
class WindowsAppearanceReads the light or dark mode and the accent colour the user has chosen in Windows' personalisation settings.