In this article I will show how to very quickly combine Dragablz and MaterialDesignColors in WPF to create a great looking control supporting full tear-out and can use the Google Material Design colour palette.
Start a new WPF project. We rely on two NuGet packages, so get them installed straight away. Install them from the Package Manager tool in Visual Studio, or from the NuGet console, run these commands:
- Install-Package Dragablz
- Install-Package MaterialDesignColors
In the MainWindow.xaml, setup a simple usage of the Dragablz TabablzControl:
- <Window x:Class="MaterialDesignTabExample.MainWindow"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz"
- Title="Material Design Demo" Height="350" Width="525">
- <dragablz:TabablzControl>
- <dragablz:TabablzControl.InterTabController>
- <dragablz:InterTabController />
- </dragablz:TabablzControl.InterTabController>
- <TabItem Header="HELLO">
- <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">Hello World</TextBlock>
- </TabItem>
- <TabItem Header="MATERIAL">
- <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">Material Design</TextBlock>
- </TabItem>
- <TabItem Header="DESIGN">
- <TextBlock HorizontalAlignment="Center" VerticalAlignment="Center">Looks Quite Nice</TextBlock>
- </TabItem>
- </dragablz:TabablzControl>
- </Window>
Open your App.xaml. We need to merge in three dictionaries. The first two are to set up the Material Design colour palette. The MaterialDesignColors assembly contains a ResourceDictionary for each color (a collection of hues and accents). To create a full palette we need to bring in a primary colour, set up some hue brushes and then bring in a secondary color for our accent color. The third resource dictionary is to include the Dragablz theme for Material Design. Finally we instruct our tab control to use the correct style.
Don't worry, it's not too complicated. The following is the full App.xaml:
- <Application x:Class="MaterialDesignColors.WpfExample.App"
- xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
- xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
- xmlns:dragablz="clr-namespace:Dragablz;assembly=Dragablz"
- StartupUri="MainWindow.xaml">
- <Application.Resources>
- <ResourceDictionary>
- <ResourceDictionary.MergedDictionaries>
- <!-- primary color -->
- <ResourceDictionary>
- <!-- include your primary palette -->
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/MaterialDesignColor.Indigo.xaml" />
- </ResourceDictionary.MergedDictionaries>
- <!--
- include three hues from the primary palette (and the associated forecolours).
- Do not rename, keep in sequence; light to dark.
- -->
- <SolidColorBrush x:Key="PrimaryHueLightBrush" Color="{StaticResource Primary100}"/>
- <SolidColorBrush x:Key="PrimaryHueLightForegroundBrush" Color="{StaticResource Primary100Foreground}"/>
- <SolidColorBrush x:Key="PrimaryHueMidBrush" Color="{StaticResource Primary500}"/>
- <SolidColorBrush x:Key="PrimaryHueMidForegroundBrush" Color="{StaticResource Primary500Foreground}"/>
- <SolidColorBrush x:Key="PrimaryHueDarkBrush" Color="{StaticResource Primary700}"/>
- <SolidColorBrush x:Key="PrimaryHueDarkForegroundBrush" Color="{StaticResource Primary700Foreground}"/>
- </ResourceDictionary>
- <!-- secondary colour -->
- <ResourceDictionary>
- <!-- include your secondary pallette -->
- <ResourceDictionary.MergedDictionaries>
- <ResourceDictionary Source="pack://application:,,,/MaterialDesignColors;component/Themes/MaterialDesignColor.Yellow.xaml" />
- </ResourceDictionary.MergedDictionaries>
- <!-- include a single secondary accent color (and the associated forecolour) -->
- <SolidColorBrush x:Key="SecondaryAccentBrush" Color="{StaticResource Accent200}"/>
- <SolidColorBrush x:Key="SecondaryAccentForegroundBrush" Color="{StaticResource Accent200Foreground}"/>
- </ResourceDictionary>
- <!-- Include the Dragablz Material Design style -->
- <ResourceDictionary Source="pack://application:,,,/Dragablz;component/Themes/materialdesign.xaml"/>
- </ResourceDictionary.MergedDictionaries>
- <!-- tell Dragablz tab control to use the Material Design theme -->
- <Style TargetType="{x:Type dragablz:TabablzControl}" BasedOn="{StaticResource MaterialDesignTabablzControlStyle}" />
- </ResourceDictionary>
- </Application.Resources>
- </Application>
The fun doesn't stop here, in my next article, Material Design In XAML - Mash Up! I explain how to combine this stuff with Material Design in XAML Tookit and MahApps to create an even better looking application.

Rakesh MahapatraPosted May 26, 2017, 9:44 AM
How to increase width and height for dragablz:TabablzControl because i m using left side of my window and my header going more than 15 words so tell how to increase please ..
Mauro AllendePosted Nov 7, 2016, 9:22 AM
Hi James! I am using dragablz control and I need to execute a command when I click on one of the tab. is this possible? Thanks!
Jasiel GuillenPosted Jul 14, 2016, 11:51 PM
So good, it's very cool ;), but a simple question: How do i add a grid into tab? I need to add others components that can move with the mouse in design mode. Help me please :)
Sandeep SharmaPosted Apr 12, 2015, 7:22 AM
nice