Styles

Child Pages

Buttons

Every Button, RepeatButton and ToggleButton in a MahApps application is styled without any markup on your side. Beyond that the library ships a set of keyed styles to pick from — square, circular, flat, chromeless — plus a good many that belong to particular controls.

Calendar

The Calendar is styled without any markup on your side, and the same style is what a DatePicker drops down. Because a calendar is assembled from four controls rather than one, restyling it is a matter of knowing which of the four draws the part you want to change.

CheckBox

Every CheckBox in a MahApps application is styled without any markup on your side. There is one alternative style with the Windows 10 look, and everything about the appearance — size, shape, glyph and the colour of each state — is reachable through attached properties.

ComboBox

Every ComboBox in a MahApps application is styled without any markup on your side, drop-down and items included. On top of that come a watermark, a clear button and the editable variant with auto-completion.

DataGrid

DataGrid ships with WPF; MahApps restyles it and everything inside it. There is one alternative style, and a set of properties for the parts of a grid that WPF gives you no other way to reach.

DataGrid Columns

A DataGrid column shows one control when the cell is at rest and a different one while it is being edited, and each needs a style. MahApps supplies both for every built-in column type — and, more usefully, applies them without being asked.

DatePicker

Every DatePicker in a MahApps application is styled without any markup on your side, and so is the calendar that drops out of it. On top of that the library adds a watermark and a clear button, both through the same attached properties a TextBox uses.

Expander

An Expander gets the same accent header band as a GroupBox, plus a toggle arrow and a fade when it opens. Its header is a ToggleButton, and which way that button points depends on ExpandDirection — which is why the style carries four header styles rather than one.

GridSplitter

GridSplitter is the bar a user drags to resize two panes of a Grid. MahApps keeps WPF's template and changes four things: the colour, both alignments, and — a behavioural one — the drag preview.

GroupBox

A GroupBox gets an accent-filled header band and a bordered body. There are two alternative styles, and the header is reachable through attached properties rather than a template.

Hyperlink

A Hyperlink is an inline, not a control, so it lives inside a TextBlock and is styled rather than templated. MahApps gives it the Metro treatment: underlined, in the ordinary text colour, and only coloured once the pointer is over it.

ListBox

Two implicit styles, one for the list and one for the items in it. Styles/Controls.xaml applies both, so the quick start is the whole setup.

ListView

Three implicit styles cover a ListView: the list, its rows, and the column headers a GridView puts above them. Styles/Controls.xaml applies all three.

Menus

Three styles, all applied implicitly by Styles/Controls.xaml: MahApps.Styles.Menu for the bar, MahApps.Styles.ContextMenu for the popup, and MahApps.Styles.MenuItem for what goes in either. The quick start is the whole setup.

Page

MahApps.Styles.Page is three setters and no template, and it is the one style on this site you have to apply by hand — Styles/Controls.xaml does not make it implicit.

PasswordBox

Every PasswordBox in a MahApps application is styled without any markup on your side. On top of that the library adds a caps lock warning, a watermark, a clear button, a reveal button and a bindable password — all through attached properties, so nothing has to be subclassed.

ProgressBar

WPF's ProgressBar gets a flat track and a gradient indicator, plus a striped indeterminate state in place of the sliding block.

RadioButton

Every RadioButton in a MahApps application is styled without any markup on your side. As with the CheckBox there is one alternative style with the Windows 10 look, and the whole appearance is reachable through attached properties.

ScrollBar

Two styles, both applied implicitly by Styles/Controls.xaml: MahApps.Styles.ScrollBar for the bar and MahApps.Styles.ScrollViewer for what holds it. The quick start is the whole setup.

Slider

Three styles, all in Controls.xaml and all ready to use without loading anything extra.

StatusBar

Two implicit styles, applied by Styles/Controls.xaml. A MahApps status bar is not a grey strip at the bottom of the window — it is a second title bar, in the accent colour, and it dims with the window.

TabControl

Two implicit styles cover a plain WPF TabControl — the control and its items — plus two keyed variants that animate the page change. Styles/Controls.xaml applies the implicit pair.

Text

Two ways to put a line of text on screen, and MahApps treats them very differently: Label gets a full style and a template, TextBlock deliberately gets almost nothing.

TextBox

Every TextBox in a MahApps application is styled without any markup on your side. On top of that the library adds a watermark, a clear button, a command button and a search variant — all through attached properties, so nothing has to be subclassed.

ToggleButton

A ToggleButton is a button that stays pressed. MahApps styles it to match the ordinary buttons and adds a circular and a flat variant.

ToolBar

Two implicit styles — the bar and the tray it sits in — plus a set of styles for the controls that go inside one, which WPF applies for you through its own style keys.

ToolTip

One style, applied implicitly, that turns WPF's tooltip into a flat bordered card in the theme colours and fades it in and out.

TreeView

Two implicit styles, one for the tree and one for its nodes, applied by Styles/Controls.xaml.

Validation

WPF marks a control whose binding failed validation by drawing an adorner over it, and which adorner is up to Validation.ErrorTemplate. MahApps supplies one — MahApps.Templates.ValidationError — and sets it on the input controls it styles.

Related Sections