New to Telerik UI for WPF? Download free 30-day trial

Crystal Theme

With the R3 2018 release of the UI for WPF suite we have introduced the brand new Crystal theme. Inspired by MacOS, the Crystal theme delivers the renown Mac OS look and feel to your WPF apps. The team at Apple have been a trend setter with their clean UI and with the Crystal theme you will be able to bring that style to your own apps.

Default Theme Colors

The Crystal Theme is designed to be easily modified via the exposed colors in the theme palette.

The default values of the brushes in the theme are listed below. Please note that as the theme uses a number of gradients, most of the colors have a low and high value which indicates the colors at both stops of the gradient.

Color name Light Dark
AccentHighColor #FF56A9FD
AccentLowColor #FF087EFF
AccentMouseOverHighColor #FF2590FB
AccentMouseOverLowColor #FF0072EE
AccentPressedColor #FF0060CF
AccentFocusedColor #FF7CB7F9
AccentSelectedColor #FF1C83FF
BasicHighColor #FFCCCCCC
BasicLowColor #FFA4A3A4
AccentBasicHighColor #FF2390FD
AccentBasicLowColor #FF0052E6
IconColor #FF505050
MainHighColor #FFFFFFFF
MainLowColor #FFF3F3F3
MarkerColor #FF020202
ValidationColor #FFD40012
ComplementaryColor #FFDEDEDE
ComplementaryBasicHighColor #FFADADAD
ComplementaryBasicLowColor #FF8D8D8D
MouseOverHighColor #FFF3F3F3
MouseOverLowColor #FFEEEEEE
PressedHighColor #FFDCDCDC
PressedLowColor #FFCDCDCD
AlternativeColor #FFEAEAEA
AlternativeBasicColor #FFD3D3D3
MarkerInvertedColor #FFFFFFFF
PrimaryBackgroundColor #FFFFFFFF
HeaderHighColor #FFE8E6E6
HeaderLowColor #FFD4D0D0
ReadOnlyBackgroundColor #FFFFFFFF
ReadOnlyBorderColor #FFA4A3A4

Figure 1: Theme colors represented in RadOutlookBar

Crystal theme colors represented in RadOutlookBar

CrystalPalette Properties

Primary Brushes

  • PrimaryBackgroundBrush: Used in backgrounds of inputs.
  • MainBrush: Used for backgrounds of buttons.
  • AlternativeBrush: Used for backgrounds of popups, windows, listboxes etc.
  • AlternativeBasicBrush: Used for borders in the cases when several would overlap (in complex grid-structured controls) and is calculated automatically when the BasicBrush is changed by overlaying it on top of the PrimaryBackgroundBrush
  • BasicBrush: Used in the majority of the normal state borders.
  • ComplementaryBrush: Slightly darker than the alternative in case of collisions. Used for background of footers as well.
  • ComplementaryBasicBrush: Used for borders of windows.
  • MarkerBrush: Used for the majority of foregrounds which are black.
  • MarkerInvertedBrush: Used for interactions states - white in both variations.
  • IconBrush: Used for glyph and path icons, which should be 80% of black.
  • AccentBrush: Used for backgrounds of radio, repeat, split, toggle buttons, as well as picker control buttons – DatePicker, DateTimePicker, CalculatorPicker, etc.
  • AccentBasicBrush: Used for border of the above-mentioned controls, that have AccentBrush for their background.

Interaction State Brushes

  • AccentFocusedBrush: Variation of the AccentBrush that is used for the focused states of primary accent elements.
  • AccentMouseOverBrush: Variation of the AccentBrush that is used for the hovered states of primary accent elements.
  • AccentSelectedBrush: Variation of the AccentBrush that is used for the selected states of primary accent elements.
  • AccentPressedBrush: Variation of the AccentBrush that is used for the pressed states of primary accent elements.
  • MouseOverBrush: Used in backgrounds for the hovered states of non-accent elements.
  • PressedBrush: Used in backgrounds for the pressed states of non-accent elements.

Special Brushes

  • HeaderBrush: Used in backgrounds of header elements.
  • ValidationBrush:  A bright red brush used for indicating validation errors - for the underline of the invalid control and as a background for the error tooltip, background for invalid rows and cells as well as for clear buttons' mouse over states.

Other Properties

  • DisabledOpacity: Used for text when they are disabled. Backgrounds usually use the AlternativeBrush when disabled.
  • InputOpacity: Used for text in masked input controls and watermark elements.
  • ReadOnlyOpacity: Used for text in inputs when they are in a read-only state.
  • FocusThickness: The default value is 2, 2, 2, 2. It is used for the thickness of the focus border.

Theme Variation Changing

You can switch between the color palettes by calling the LoadPreset method as shown below:

Example 1: Changing the color variantion of the theme

//default color variation 
//dark color variation 

The Dark variation of the theme is designed with a dark background in mind and it is recommended to use such a background in your application when working with it.

Font Family and Font Size

When using the Crystal theme you can dynamically change the FontSize and FontFamily properties of all components in the application the same way as you do in Windows8, Windows8Touch, Office2013, VisualStudio2013, Office2016, Green, Material and Fluent themes.

The FontSize and FontFamily properties are public so you can easily modify the theme resources at a single point. The most commonly used font size in the theme is with value 13 and can be modified through the CrystalPalette.Palette.FontSize property in the same manner as in the other themes that support a theme palette.

The default font used in the theme is Roboto.

For complex scenarios we strongly recommend setting the FontSize properties only before the application is initialized.

Example 1 shows the default font sizes and families.

Example 2: Default FontSize

CrystalPalette.Palette.FontSizeXS = 11; 
CrystalPalette.Palette.FontSizeS = 12; 
CrystalPalette.Palette.FontSize = 13; 
CrystalPalette.Palette.FontSizeL = 14; 
CrystalPalette.Palette.FontSizeXL = 15; 
Example 2 shows how to change the default FontFamily from "Roboto" to "Calibri Italic" and the FontSize from 13 to 14.

Example 3: Changing the theme's FontSize and FontFamily

private void OnButtonChangeFontSizeClick(object sender, RoutedEventArgs e) 
    CrystalPalette.Palette.FontSize = 16; 
    CrystalPalette.Palette.FontFamily = new FontFamily("Calibri Italic"); 

Figure 2: Setting FontSize and FontFamily

RadCalendar with modified FontSize and FontFamiliy


The Crystal Theme also uses the Telerik Web UI font glyphs by default. The RadGlyph provides a lightweight, flexble and design-time-friendly implementation of our glyph font.

You can read more about the RadGlyph in the RadGlyph Overview article and about the range of the font glyphs in the Font Glyphs Overview article.

Set Corner Radius

The Crystal Theme exposes an easy way to modify the corner radius of many elements in your application. You can directly use the corner radius property of the palette. By default the CornerRadius value is 5.

Example 3 shows how to change the default corner radius from 5 to 0. Note that you don't have to explicitly change all 5 corner radius properties as they will inherit the value from the main CornerRadius property.

Example 4: Changing the default corner radius

CrystalPalette.Palette.CornerRadius = new CornerRadius(0);   

Figure 3: Apperance of a RadButton control after changing the default corner radius

RadButton with a CornerRadius of 0

Material Assist

The MaterialAssist static class comes from the Material theme and it is reused in the Crystal theme. It exposes a set of attached properties and can be used to directly modify the appearance of a specific basic control without the need to alter its control template. Below is a list of the dependency properties which can be set directly in XAML:

  • MouseOverBrush: Sets the value of the background Brush applied when the mouse is over the control.
  • PressedBrush: Sets the value of the background Brush applied when the control is pressed.
  • CheckedBrush: Sets the value of the background Brush applied when the element is in Checked state. It will have effect when used on elements that expose a "checked" state(ToggleButton, RadListBoxItem, etc.)
  • FocusBrush: Sets the value of the background Brush applied when the element is focused.
  • ShadowDepth: Enum property that indicates the depth of the shadow effect over the control. There are 5 values that can be selected.
  • IsShadowDisabled: The property is used to control the visibility of the shadow effect.
  • CornerRadius: Used to set the corner radius of commonly used basic controls that could need corner radius customizations but don't expose such property by default (e.g. Button, RepeatButton, ListBox, RadComboBox, etc.).

Example 6 shows a RadToggleButton control with modified brushes for its different states through the MaterialAssist class:

Example 5: Declare the namespace for the Material components


Example 6: Set RadToggleButton's visual appearance through the MaterialAssist class

  <telerik:RadToggleButton Content="RadButton"  
                           mat:MaterialAssist.MouseOverBrush="{telerik:CrystalResource ResourceKey=AccentMouseOverBrush}" 
                           mat:MaterialAssist.PressedBrush="{telerik:CrystalResource ResourceKey=AccentPressedBrush}" 
                           mat:MaterialAssist.CheckedBrush="{telerik:CrystalResource ResourceKey=ValidationBrush}"/> 

Figure 4: Appearance of the RadToggleButton in the different states

RadToggleButton States

Window Buttons Alignment

In accordance to the MacOS design, by default the minimize, maximize, restore and close buttons of the RadWindow controls are displayed on the left of the window's title in the Crystal theme. This can be easily modified via the WindowButtonsAlignment property of the Crystal palette.

Example 7: Changing the WindowButtonsAlignment

CrystalPalette.Palette.WindowButtonsAlignment = ButtonsAlignment.Right;      

Figure 5: Appearance of the RadWindow with the different alignments

RadToggleButton States

Change ScrollBarsMode

By default, the scrollbars in the Crystal theme change their size depending on whether the mouse is currently over them. They are normally smaller in size to take less space and become wider when hovered. Since the R1 2020 SP1, you have the option of setting the ScrollBarsMode property of the Crystal palette in order to control this behavior. It is of type ScrollViewerScrollBarsMode and can be set to one of the following values:

  • ScrollViewerScrollBarsMode.Auto: The ScrollBars appear as a narrow sliver and expand to normal size on MouseOver. This is the default value.

  • ScrollViewerScrollBarsMode.Compact: The ScrollBars appear always as a narrow sliver.

  • ScrollViewerScrollBarsMode.Normal: The ScrollBars appear always with their normal size.

The ScrollViewerScrollBarsMode enumeration of the CrystalPalette can be found under the Telerik.Windows.Controls.Theming namespace.

Figure 6: ScrollBar behavior in Auto, Compact and Normal ScrollBarsMode

ScrollBar in Auto, Compact and Normal ScrollBarsMode

Example 8 demonstrates how the ScrollBarsMode property of the palette can be set.

Example 8: Setting the ScrollBarsMode property of the palette to Compact

CrystalPalette.Palette.ScrollBarsMode = Telerik.Windows.Controls.Theming.ScrollViewerScrollBarsMode.Compact; 

Changing Opacity

If you need to change the opacity of the disabled and read-only elements, you can now easily do so by using the DisabledOpacity and ReadOnlyOpacity properties of the CrystalPalette. The default values are 0.35 and 0.55 respectively.

Example 9: Changing the opacity

CrystalPalette.Palette.DisabledOpacity = 0.5; 
CrystalPalette.Palette.ReadOnlyOpacity = 0.5; 
CrystalPalette.Palette.DisabledOpacity = 0.5 
CrystalPalette.Palette.ReadOnlyOpacity = 0.5 

See Also

In this article
Not finding the help you need? Improve this article