🚀 Welcome to MDriven Learn –  MDriven is now on Discord!  Don’t miss the latest Release Notes.
Wpf materialdesign
This page was created by Hans.karlsen on 2019-03-06. Last edited by Wikiadmin on 2026-07-29.

You can use this page to identify retired Material Design guidance for MDriven WPF applications and find the current documentation for styling, icons, and custom controls.

Status

This page documents behavior that is invalid for versions after 2019-05-07. Do not use the workaround described below in a current application.

For current WPF application and ViewModel styling, use Documentation:Styling WPF Applications and ViewModels. For the WPF client architecture and generated user interface, see Documentation:Windows WPF client.

Current guidance

MDriven WPF applications can be styled through XAML resource dictionaries and style references on ViewModel columns. A resource dictionary is a XAML file that defines reusable resources such as brushes and control styles. A StyleRef identifies the style that a ViewModel column should use.

For example, when a ViewModel column has the StyleRef Style1, you can define separate styles for the generated display and edit controls using the naming convention described in Documentation:Styling WPF Applications and ViewModels:

<Style x:Key="Style1.TextBlock">
  <Setter Property="TextBlock.FontSize" Value="36"/>
</Style>

<Style x:Key="Style1.TextBox" TargetType="{x:Type TextBox}">
  <Setter Property="FontSize" Value="36"/>
</Style>

Use Documentation:StylesInModel when you want styles defined in the model to be generated into a WPF resource dictionary. Use HowTos:Custom Controls in ViewModel Aided Views when a generated ViewModel view needs a custom WPF control while retaining model-driven data binding.

Material Design icons

For Material Design icons in WPF, follow Documentation:Material Design Icons. That page describes the included font resource, the materialdesigniconsfont font-family resource, and the hooks on ViewModelWPFUserControl for resolving named icons.

For action-button icons in Turnkey, set the Icon tagged value on the ViewModel column that contains the action. See Documentation:Action Controls for the icon-name convention and the IconPosition tagged value.

Historical note: retired layout workaround

Earlier MDriven WPF applications used MaterialDesign-styled controls from the MaterialDesignInXaml library. In that older implementation, some layouts could repeatedly increase the size of controls during initialization. The observed pattern was that a line beneath a control was data-bound to the control width, and the two measurements could affect one another in a repeating layout cycle.

The former workaround was to set a control's MaxWidth to 3.14. MDriven treated that value as a temporary initialization limit, then removed it after the initial ViewModel-driven user-interface setup so the control could again size automatically.

Do not add MaxWidth="3.14" to new or maintained WPF views. It is historical behavior only, and the original guidance states that it is invalid after 2019-05-07. If a current view grows or continuously remeasures, review its XAML layout and bindings, then use the current WPF styling and custom-control guidance linked above.

See also