<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Office2016InspiredApplication" 
                    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
                    xmlns:sys="clr-namespace:System;assembly=mscorlib"
                    xmlns:appearance="clr-namespace:Office2016InspiredApplication.Appearance"
                    xmlns:telerikRibbonView="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.RibbonView"
                    xmlns:telerikRibbonViewPrimitives="clr-namespace:Telerik.Windows.Controls.RibbonView.Primitives;assembly=Telerik.Windows.Controls.RibbonView">

    <!--custom templates that: 1. remove Foreground animation on Pressed visual state, 
    2. change the BorderBrush on Checked buttons to MouseOverBrush and
    3. increase the distance between DropDownIndicator and textRow1 with 5px -->
    
    <ControlTemplate x:Key="RadRibbonButtonTemplate" TargetType="telerikRibbonView:RadRibbonButton">
        <Grid>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal"/>
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ButtonBackgroundHover"/>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ButtonBackgroundHover"/>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="ButtonBackgroundPressed"/>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetName="ContentGrid" Storyboard.TargetProperty="Opacity"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusStates">
                    <VisualState x:Name="Focused"/>
                    <VisualState x:Name="Unfocused"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="KeyboardNavigationStates">
                    <VisualState x:Name="KeyboardUnfocused"/>
                    <VisualState x:Name="KeyboardFocused">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="KeyboardNavigationVisual"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="ButtonBackgroundDecorator"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    CornerRadius="{TemplateBinding CornerRadius}"/>
            <Border x:Name="ButtonBackgroundPressed"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    Opacity="0"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=AccentDarkBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=AccentDarkBrush}"/>
            <Border x:Name="ButtonBackgroundHover"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    Opacity="0"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"/>
            <Border x:Name="KeyboardNavigationVisual"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Opacity="0"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"/>
            <Grid
                    Margin="{TemplateBinding Padding}"
                    x:Name="ContentGrid"
                    HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                    VerticalAlignment="{TemplateBinding VerticalContentAlignment}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Image Name="Image" VerticalAlignment="Top"/>
                <StackPanel x:Name="FirstRowContainer" Grid.Row="1" Tag="qq">
                    <ContentPresenter x:Name="ContentPresenter"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            RecognizesAccessKey="True"
                            ContentStringFormat="{TemplateBinding ContentStringFormat}"
                            TextBlock.Foreground="{TemplateBinding Foreground}"/>
                    <TextBlock Name="textRow1" Text="{TemplateBinding TextRow1}" TextAlignment="Center" Foreground="{TemplateBinding Foreground}"/>
                </StackPanel>
                <TextBlock
                        Name="textRow2"
                        Grid.Row="2"
                        VerticalAlignment="Top"
                        Margin="0 -3 0 0"
                        Text="{TemplateBinding TextRow2}"
                        TextAlignment="Center"
                        Foreground="{TemplateBinding Foreground}"/>
            </Grid>
        </Grid>
    </ControlTemplate>

    <Style TargetType="telerikRibbonView:RadRibbonButton" BasedOn="{StaticResource RadRibbonButtonStyle}">
        <Setter Property="Template" Value="{StaticResource RadRibbonButtonTemplate}" />
    </Style>

    <ControlTemplate x:Key="RadRibbonRadioButtonTemplate" TargetType="telerikRibbonView:RadRibbonRadioButton">
        <Grid>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal"/>
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="MouseOverVisual"/>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="PressedVisual"/>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetName="ContentGrid" Storyboard.TargetProperty="Opacity"/>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="MouseOverChecked">
                        <Storyboard>
                            <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverCheckedVisual" Storyboard.TargetProperty="Opacity" To="1"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusStates">
                    <VisualState x:Name="Focused"/>
                    <VisualState x:Name="Unfocused"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="CheckStates">
                    <VisualState x:Name="Unchecked"/>
                    <VisualState x:Name="Checked">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CheckedVisual"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="KeyboardNavigationStates">
                    <VisualState x:Name="KeyboardUnfocused"/>
                    <VisualState x:Name="KeyboardFocused">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="KeyboardNavigationVisual"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="NormalVisual"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    CornerRadius="{TemplateBinding CornerRadius}"/>
            <Border x:Name="CheckedVisual"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    Opacity="0"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"/>
            <Border x:Name="PressedVisual"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=AccentDarkBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=AccentDarkBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    Opacity="0"/>
            <Border x:Name="MouseOverVisual"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    Opacity="0"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"/>
            <Border x:Name="MouseOverCheckedVisual"
                                    Opacity="0"
                                    BorderThickness="1"
                                    CornerRadius="{TemplateBinding CornerRadius}"
                                    Background="Transparent"
                                    BorderBrush="{appearance:Office2016Resource Resource=MouseOverCheckedBorderBrush}"/>
            <Border x:Name="KeyboardNavigationVisual"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Opacity="0"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"/>
            <Grid HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" x:Name="ContentGrid">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Image Name="Image" VerticalAlignment="Top"/>
                <StackPanel x:Name="FirstRowContainer" Grid.Row="1">
                    <ContentPresenter x:Name="ContentPresenter"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            RecognizesAccessKey="True"
                            ContentStringFormat="{TemplateBinding ContentStringFormat}"
                            TextBlock.Foreground="{TemplateBinding Foreground}"/>
                    <TextBlock Name="textRow1" Text="{TemplateBinding TextRow1}" TextAlignment="Center" Foreground="{TemplateBinding Foreground}"/>
                </StackPanel>
                <TextBlock
                        Name="textRow2"
                        Grid.Row="2"
                        VerticalAlignment="Top"
                        Margin="0 -3 0 0"
                        Text="{TemplateBinding TextRow2}"
                        TextAlignment="Center"
                        Foreground="{TemplateBinding Foreground}"/>
            </Grid>
        </Grid>
    </ControlTemplate>

    <Style TargetType="telerikRibbonView:RadRibbonRadioButton" BasedOn="{StaticResource RadRibbonRadioButtonStyle}">
        <Setter Property="Template" Value="{StaticResource RadRibbonRadioButtonTemplate}" />
    </Style>

    <ControlTemplate x:Key="RadRibbonToggleButtonTemplate" TargetType="telerikRibbonView:RadRibbonToggleButton">
        <Grid>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal"/>
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="MouseOverVisual"/>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="PressedVisual"/>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetName="ContentGrid" Storyboard.TargetProperty="Opacity"/>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="MouseOverChecked">
                        <Storyboard>
                            <DoubleAnimation Duration="0" Storyboard.TargetName="MouseOverCheckedVisual" Storyboard.TargetProperty="Opacity" To="1"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="CheckStates">
                    <VisualState x:Name="Unchecked"/>
                    <VisualState x:Name="Checked">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CheckedVisual"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusStates">
                    <VisualState x:Name="Focused"/>
                    <VisualState x:Name="Unfocused"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="KeyboardNavigationStates">
                    <VisualState x:Name="KeyboardUnfocused"/>
                    <VisualState x:Name="KeyboardFocused">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="KeyboardNavigationVisual"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="NormalVisual"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    CornerRadius="{TemplateBinding CornerRadius}"/>
            <Border x:Name="CheckedVisual"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    Opacity="0"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"/>
            <Border x:Name="PressedVisual"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=AccentDarkBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=AccentDarkBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    Opacity="0"/>
            <Border x:Name="MouseOverVisual"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    Opacity="0"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"/>
            <Border x:Name="MouseOverCheckedVisual"
                                    Opacity="0"
                                    BorderThickness="1"
                                    CornerRadius="{TemplateBinding CornerRadius}"
                                    Background="Transparent"
                                    BorderBrush="{appearance:Office2016Resource Resource=MouseOverCheckedBorderBrush}"/>
            <Border x:Name="KeyboardNavigationVisual"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Opacity="0"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"/>
            <Grid x:Name="ContentGrid" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Image Name="Image" VerticalAlignment="Top"/>
                <StackPanel x:Name="FirstRowContainer" Grid.Row="1">
                    <ContentPresenter x:Name="ContentPresenter"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            RecognizesAccessKey="True"
                            ContentStringFormat="{TemplateBinding ContentStringFormat}"
                            TextBlock.Foreground="{TemplateBinding Foreground}"/>
                    <TextBlock Name="textRow1" Text="{TemplateBinding TextRow1}" TextAlignment="Center" Foreground="{TemplateBinding Foreground}"/>
                </StackPanel>
                <TextBlock
                        Name="textRow2"
                        Grid.Row="2"
                        VerticalAlignment="Top"
                        Margin="0 -3 0 0"
                        Text="{TemplateBinding TextRow2}"
                        TextAlignment="Center"
                        Foreground="{TemplateBinding Foreground}"/>
            </Grid>
            <Rectangle x:Name="Background_Disabled" Visibility="Collapsed" Fill="#99FFFFFF"/>
        </Grid>
    </ControlTemplate>

    <Style TargetType="telerikRibbonView:RadRibbonToggleButton" BasedOn="{StaticResource RadRibbonToggleButtonStyle}">
        <Setter Property="Template" Value="{StaticResource RadRibbonToggleButtonTemplate}" />
    </Style>

    <ControlTemplate x:Key="RadRibbonSplitButtonTemplate" TargetType="telerikRibbonView:RadRibbonSplitButton">
        <Grid>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonPart" Storyboard.TargetProperty="BorderThickness">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>0</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownPart" Storyboard.TargetProperty="BorderThickness">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>0</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backgroundDecorator" Storyboard.TargetProperty="BorderBrush" Duration="0">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <DoubleAnimation Storyboard.TargetName="backgroundDecorator" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="backgroundDecorator" Storyboard.TargetProperty="BorderBrush" Duration="0">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{telerik:VisualStudio2013Resource ResourceKey=AccentBrush}"/>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetName="ContentGrid" Storyboard.TargetProperty="Opacity"/>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonPart" Storyboard.TargetProperty="BorderThickness">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>0</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonPart" Storyboard.TargetProperty="IsBackgroundVisible">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Boolean>False</sys:Boolean>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownPart" Storyboard.TargetProperty="BorderThickness">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>0</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownPart" Storyboard.TargetProperty="IsBackgroundVisible">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Boolean>False</sys:Boolean>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="IsOpenState">
                    <VisualState x:Name="Closed"/>
                    <VisualState x:Name="Opened">
                        <Storyboard/>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusState">
                    <VisualState x:Name="Unfocused"/>
                    <VisualState x:Name="Focused"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="Text1VisibilityState">
                    <VisualState x:Name="Text1Show"/>
                    <VisualState x:Name="Text1Hide">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="textRow1" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="Text2VisibilityState">
                    <VisualState x:Name="Text2Show"/>
                    <VisualState x:Name="Text2Hide">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="textRow2" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="DropDownButtonPositionState">
                    <VisualState x:Name="DropDownButtonAtTop"/>
                    <VisualState x:Name="DropDownButtonAtLeft"/>
                    <VisualState x:Name="DropDownButtonAtBottom"/>
                    <VisualState x:Name="DropDownButtonAtRight">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonPart" Storyboard.TargetProperty="(Grid.RowSpan)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>4</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonPart" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>2</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownPanel" Storyboard.TargetProperty="(Grid.Column)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>2</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownPanel" Storyboard.TargetProperty="(Grid.RowSpan)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>4</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownPanel" Storyboard.TargetProperty="(Grid.Row)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>0</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownPanel" Storyboard.TargetProperty="Margin">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>1 0 0 0</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownPanel" Storyboard.TargetProperty="VerticalAlignment">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <VerticalAlignment>Center</VerticalAlignment>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownPart" Storyboard.TargetProperty="(Grid.Column)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>2</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownPart" Storyboard.TargetProperty="(Grid.Row)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>0</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="textRow1" Storyboard.TargetProperty="(Grid.Row)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>0</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="textRow1" Storyboard.TargetProperty="(Grid.Column)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>1</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="textRow1" Storyboard.TargetProperty="Margin">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>4 0 1 0</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="textRow1" Storyboard.TargetProperty="VerticalAlignment">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <VerticalAlignment>Center</VerticalAlignment>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="textRow1" Storyboard.TargetProperty="HorizontalAlignment">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <HorizontalAlignment>Left</HorizontalAlignment>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="textRow1" Storyboard.TargetProperty="TextAlignment">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <TextAlignment>Left</TextAlignment>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="textRow1" Storyboard.TargetProperty="(Grid.RowSpan)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>4</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="textRow1" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>1</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Image" Storyboard.TargetProperty="(Grid.RowSpan)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>4</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Image" Storyboard.TargetProperty="(Grid.ColumnSpan)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>1</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="DropDownContentState">
                    <VisualState x:Name="HasDropDownContent"/>
                    <VisualState x:Name="WithoutDropDownContent">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DropDownIndicator">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="IsOpenOrChecked">
                    <VisualState x:Name="OpenOrChecked">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ButtonPart" Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"/>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="DropDownPart" Storyboard.TargetProperty="Background">
                                <DiscreteObjectKeyFrame KeyTime="0" Value="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"/>
                            </ObjectAnimationUsingKeyFrames>
                            <DoubleAnimation Storyboard.TargetName="checkedDecorator" Storyboard.TargetProperty="Opacity" Duration="0" To="1"/>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ButtonPart" Storyboard.TargetProperty="IsBackgroundVisible">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Boolean>True</sys:Boolean>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="NotOpenNotChecked"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="KeyboardNavigationStates">
                    <VisualState x:Name="KeyboardUnfocused"/>
                    <VisualState x:Name="KeyboardFocused">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="KeyboardNavigationVisual"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="backgroundDecorator" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" BorderThickness="1"/>
            <Border x:Name="KeyboardNavigationVisual"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Opacity="0"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"/>
            <Grid x:Name="ContentGrid">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <telerik:RadButton x:Name="ButtonPart"
                        Grid.ColumnSpan="3"
                        MinHeight="0"
                        MinWidth="0"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        IsBackgroundVisible="{TemplateBinding IsBackgroundVisible}"
                        Background="Transparent"
                        IsTabStop="False"
                        Foreground="{TemplateBinding Foreground}"
                        Content="{TemplateBinding Content}"
                        ContentTemplate="{TemplateBinding ContentTemplate}"
                        HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
                        VerticalContentAlignment="{TemplateBinding VerticalContentAlignment}"
                        Padding="{TemplateBinding Padding}"
                        ContentStringFormat="{TemplateBinding ContentStringFormat}"
                        CornerRadius="0"/>
                <telerik:RadToggleButton x:Name="DropDownPart"
                        Grid.Row="1"
                        Grid.RowSpan="4"
                        Foreground="{TemplateBinding Foreground}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        MinHeight="0"
                        Grid.ColumnSpan="2"
                        Background="Transparent"
                        IsTabStop="False"
                        Visibility="{TemplateBinding DropDownIndicatorVisibility}"
                        HorizontalAlignment="Stretch"
                        Padding="6"
                        CornerRadius="0"
                        IsChecked="{Binding Path=IsOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"/>
                <Image Name="Image" IsHitTestVisible="False" Margin="{TemplateBinding Padding}" Grid.ColumnSpan="2" HorizontalAlignment="Center"/>
                <TextBlock
                        Name="textRow1"
                        Grid.Row="1"
                        Grid.ColumnSpan="2"
                        IsHitTestVisible="False"
                        Padding="3 0"
                        Text="{TemplateBinding TextRow1}"
                        TextAlignment="Center"
                        Foreground="{TemplateBinding Foreground}"/>
                <StackPanel
                        Name="DropDownPanel"
                        VerticalAlignment="Top"
                        Grid.Row="2"
                        Grid.ColumnSpan="2"
                        Grid.RowSpan="2"
                        HorizontalAlignment="Center"
                        Orientation="Horizontal"
                        Margin="3 -3 3 0"
                        IsHitTestVisible="False">
                    <TextBlock Name="textRow2" Text="{TemplateBinding TextRow2}" IsHitTestVisible="False" Foreground="{TemplateBinding Foreground}"/>
                    <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                        <Path x:Name="DropDownIndicator"
                                IsHitTestVisible="False"
                                Visibility="{TemplateBinding DropDownIndicatorVisibility}"
                                SnapsToDevicePixels="True"
                                Fill="{telerik:VisualStudio2013Resource ResourceKey=StrongBrush}"
                                Data="M0,0L6,0L3,4z"
                                Margin="3 6"/>
                    </Grid>
                </StackPanel>
            </Grid>
            <Border x:Name="checkedDecorator" Opacity="0" BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}" BorderThickness="1"/>
            <Popup x:Name="DropDownPopup"
                    AllowsTransparency="True"
                    StaysOpen="False"
                    Focusable="False"
                    Placement="Bottom"
                    IsOpen="{Binding Path=IsOpen, RelativeSource={RelativeSource TemplatedParent}}">
                <Grid>
                    <Border x:Name="DropDownPopupBorder"
                            BorderThickness="1"
                            MinWidth="3"
                            MinHeight="3"
                            Width="{TemplateBinding DropDownWidth}"
                            Height="{TemplateBinding DropDownHeight}"
                            MaxWidth="{TemplateBinding DropDownMaxWidth}"
                            MaxHeight="{TemplateBinding DropDownMaxHeight}"
                            Background="{telerik:VisualStudio2013Resource ResourceKey=PrimaryBrush}"
                            BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=BasicBrush}">
                        <ContentControl x:Name="DropDownPopupContent"
                                IsTabStop="False"
                                Content="{TemplateBinding DropDownContent}"
                                ContentTemplate="{TemplateBinding DropDownContentTemplate}"
                                HorizontalAlignment="Stretch"
                                VerticalAlignment="Stretch"
                                DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DataContext}"/>
                    </Border>
                </Grid>
            </Popup>
            <Rectangle x:Name="disabledDecorator" Visibility="Collapsed" Opacity="0" Fill="#FFFFFFFF"/>
        </Grid>
    </ControlTemplate>

    <Style TargetType="telerikRibbonView:RadRibbonSplitButton" BasedOn="{StaticResource RadRibbonSplitButtonStyle}">
        <Setter Property="Template" Value="{StaticResource RadRibbonSplitButtonTemplate}" />
    </Style>

    <ControlTemplate x:Key="RadRibbonDropDownButtonTemplate" TargetType="telerikRibbonView:RadRibbonDropDownButton">
        <Grid>
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal"/>
                    <VisualState x:Name="MouseOver">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="MouseOverVisual"/>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Pressed">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="PressedVisual"/>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Disabled">
                        <Storyboard Duration="0">
                            <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetName="ContentGrid" Storyboard.TargetProperty="Opacity"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusState">
                    <VisualState x:Name="Focused"/>
                    <VisualState x:Name="Unfocused"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="IsOpenState">
                    <VisualState x:Name="Closed"/>
                    <VisualState x:Name="Opened">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="MouseOverVisual">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="CheckedVisual"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="DropDownButtonPositionState">
                    <VisualState x:Name="DropDownButtonAtTop"/>
                    <VisualState x:Name="DropDownButtonAtLeft"/>
                    <VisualState x:Name="DropDownButtonAtBottom"/>
                    <VisualState x:Name="DropDownButtonAtRight">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownPanel" Storyboard.TargetProperty="(Grid.Column)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>2</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownPanel" Storyboard.TargetProperty="(Grid.RowSpan)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>3</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownPanel" Storyboard.TargetProperty="(Grid.Row)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>0</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DropDownPanel" Storyboard.TargetProperty="VerticalAlignment">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <VerticalAlignment>Center</VerticalAlignment>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="textRow1" Storyboard.TargetProperty="(Grid.RowSpan)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>3</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(Grid.RowSpan)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>3</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentPresenter" Storyboard.TargetProperty="(Grid.Column)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>1</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FirstRowContainer" Storyboard.TargetProperty="(Grid.RowSpan)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>3</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FirstRowContainer" Storyboard.TargetProperty="(Grid.Column)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>1</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="FirstRowContainer" Storyboard.TargetProperty="Orientation">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Orientation>Horizontal</Orientation>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Image" Storyboard.TargetProperty="(Grid.RowSpan)">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <sys:Int32>3</sys:Int32>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="textRow2" Storyboard.TargetProperty="Visibility">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="DropDownPlacementState">
                    <VisualState x:Name="PlacementBottom"/>
                    <VisualState x:Name="PlacementTop"/>
                    <VisualState x:Name="PlacementLeft"/>
                    <VisualState x:Name="PlacementRight"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="DropDownContentState">
                    <VisualState x:Name="HasDropDownContent"/>
                    <VisualState x:Name="WithoutDropDownContent">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Visibility" Storyboard.TargetName="DropDownIndicator">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Visibility>Collapsed</Visibility>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
                <VisualStateGroup x:Name="DropShadowVisibilityState">
                    <VisualState x:Name="HasShadow"/>
                    <VisualState x:Name="WithoutShadow"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="KeyboardNavigationStates">
                    <VisualState x:Name="KeyboardUnfocused"/>
                    <VisualState x:Name="KeyboardFocused">
                        <Storyboard>
                            <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="KeyboardNavigationVisual"/>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Border x:Name="NormalVisual"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    CornerRadius="{TemplateBinding CornerRadius}"/>
            <Border x:Name="CheckedVisual"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    Opacity="0"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"
                    BorderThickness="1"/>
            <Border x:Name="PressedVisual"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=AccentDarkBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=AccentDarkBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    Opacity="0"/>
            <Border x:Name="MouseOverVisual"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="{TemplateBinding CornerRadius}"
                    Opacity="0"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"/>
            <Border x:Name="KeyboardNavigationVisual"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    Opacity="0"
                    Background="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"
                    BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=MouseOverBrush}"/>
            <Grid x:Name="ContentGrid" Margin="{TemplateBinding Padding}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}">
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="Auto"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Image Name="Image"/>
                <StackPanel x:Name="FirstRowContainer" Grid.Row="1">
                    <ContentPresenter x:Name="ContentPresenter"
                            Content="{TemplateBinding Content}"
                            ContentTemplate="{TemplateBinding ContentTemplate}"
                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                            RecognizesAccessKey="True"
                            ContentStringFormat="{TemplateBinding ContentStringFormat}"
                            TextBlock.Foreground="{TemplateBinding Foreground}"/>
                    <TextBlock Name="textRow1" Grid.Row="1" Text="{TemplateBinding TextRow1}" TextAlignment="Center" Foreground="{TemplateBinding Foreground}"/>
                </StackPanel>
                <StackPanel Name="DropDownPanel" Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Top" Orientation="Horizontal" Margin="0 -3 0 0">
                    <TextBlock Name="textRow2" Text="{TemplateBinding TextRow2}" Foreground="{TemplateBinding Foreground}"/>
                    <Path
                            Name="DropDownIndicator"
                            IsHitTestVisible="False"
                            VerticalAlignment="Center"
                            Visibility="{TemplateBinding DropDownIndicatorVisibility}"
                            Fill="{telerik:VisualStudio2013Resource ResourceKey=StrongBrush}"
                            Margin="3 6"
                            Data="M0,0L6,0L3,4z"/>
                </StackPanel>
            </Grid>
            <Popup x:Name="DropDownPopup" AllowsTransparency="True" StaysOpen="False" Focusable="False" Placement="Bottom">
                <Grid>
                    <Border x:Name="DropDownPopupBorder"
                            BorderThickness="1"
                            Padding="1"
                            Margin="0"
                            MinWidth="3"
                            MinHeight="3"
                            Width="{TemplateBinding DropDownWidth}"
                            Height="{TemplateBinding DropDownHeight}"
                            MaxWidth="{TemplateBinding DropDownMaxWidth}"
                            MaxHeight="{TemplateBinding DropDownMaxHeight}"
                            Background="{telerik:VisualStudio2013Resource ResourceKey=PrimaryBrush}"
                            BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=BasicBrush}">
                        <ContentControl x:Name="DropDownPopupContent"
                                Content="{TemplateBinding DropDownContent}"
                                IsTabStop="False"
                                ContentTemplate="{TemplateBinding DropDownContentTemplate}"
                                HorizontalAlignment="Stretch"
                                VerticalAlignment="Stretch"
                                DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=DataContext}"/>
                    </Border>
                </Grid>
            </Popup>
        </Grid>
    </ControlTemplate>

    <Style TargetType="telerikRibbonView:RadRibbonDropDownButton" BasedOn="{StaticResource RadRibbonDropDownButtonStyle}">
        <Setter Property="Template" Value="{StaticResource RadRibbonDropDownButtonTemplate}" />
    </Style>
</ResourceDictionary>