<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"    
                    xmlns:c1tb="clr-namespace:C1.WPF.Toolbar"
                    xmlns:c1="clr-namespace:C1.WPF;assembly=C1.WPF.4">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/C1.WPF.4;component/themes/Common.xaml" />
        <ResourceDictionary Source="/C1.WPF.Toolbar.4;component/themes/C1SimplifiedRibbon.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!-- Padding @ C1ToolbarItem -->
    <Thickness x:Key="ToolbarItemPadding">4</Thickness>

    <c1tb:C1ToolbarCommandConverter x:Key="commandConverter" />

    <!-- C1ToolbarItem -->
    <Style TargetType="c1tb:C1ToolbarItem" x:Key="C1.Silverlight.Toolbar.C1ToolbarItem">
        <Setter Property="Padding" Value="{StaticResource ToolbarItemPadding}" />
        <Setter Property="MinHeight" Value="20" />
        <Setter Property="MinWidth" Value="20" />
        <Setter Property="VerticalContentAlignment" Value="Stretch" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="c1tb:C1ToolbarItem">
                    <Grid>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="CommonStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MouseOverElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Pressed">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="PressedElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Disabled">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="DisabledVisualElement" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                            <VisualStateGroup x:Name="ToolbarStates">
                                <VisualState x:Name="Small" />
                                <VisualState x:Name="Medium">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LargeView" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MediumView" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SmallView" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="Large">
                                    <Storyboard>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LargeView" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Visible</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="MediumView" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SmallView" Storyboard.TargetProperty="(UIElement.Visibility)" Duration="0">
                                            <DiscreteObjectKeyFrame KeyTime="00:00:00">
                                                <DiscreteObjectKeyFrame.Value>
                                                    <Visibility>Collapsed</Visibility>
                                                </DiscreteObjectKeyFrame.Value>
                                            </DiscreteObjectKeyFrame>
                                        </ObjectAnimationUsingKeyFrames>
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <c1:C1BrushBuilder x:Name="BackgroundBrush" Input="{TemplateBinding Background}" DesignColor="{StaticResource BaseColor}" />
                        <c1:C1BrushBuilder x:Name="MouseOverBrush" Input="{TemplateBinding MouseOverBrush}" DesignBrush="{StaticResource SimplifiedRibbonMouseOverBrush}" DesignColor="{StaticResource MouseOverColor}" />
                        <c1:C1BrushBuilder x:Name="PressedBrush" Input="{TemplateBinding PressedBrush}" DesignBrush="{StaticResource SimplifiedRibbonSelectedBackgroundBrush}" DesignColor="{StaticResource SelectedColor}" />
                        <Border x:Name="BackgroundElement" Background="{Binding ElementName=BackgroundBrush, Path=Output}" />
                        <Border x:Name="MouseOverElement" Background="{Binding ElementName=MouseOverBrush, Path=Output}" Visibility="Collapsed" />
                        <Border x:Name="PressedElement" Background="{Binding ElementName=PressedBrush, Path=Output}" BorderBrush="{TemplateBinding PressedBrush}" Visibility="Collapsed" />
                        <Grid Margin="{TemplateBinding Padding}">
                            <StackPanel x:Name="LargeView" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource commandConverter}}" Visibility="Collapsed">
                                <TextBlock x:Name="LargeText" Visibility="Collapsed" Foreground="{TemplateBinding ActualForeground}"/>
                                <ContentControl x:Name="LargeIconContainer" Content="{Binding Path=LargeIcon, RelativeSource={RelativeSource TemplatedParent}}" Foreground="{TemplateBinding ActualForeground}"/>
                                <ContentControl x:Name="LargeContentPresenter" Content="{TemplateBinding LargeContent}" ContentTemplate="{TemplateBinding LargeContentTemplate}" Foreground="{TemplateBinding ActualForeground}" VerticalAlignment="Center"/>
                            </StackPanel>
                            <StackPanel x:Name="MediumView" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource commandConverter}}" Visibility="Collapsed" Orientation="Horizontal">
                                <TextBlock x:Name="MediumText" Visibility="Collapsed"  Foreground="{TemplateBinding ActualForeground}"/>
                                <ContentControl x:Name="MediumIconContainer" Content="{Binding Path=MediumIcon, RelativeSource={RelativeSource TemplatedParent}}" Foreground="{TemplateBinding ActualForeground}"/>
                                <ContentControl x:Name="MediumContentPresenter" Content="{TemplateBinding MediumContent}" ContentTemplate="{TemplateBinding MediumContentTemplate}" Foreground="{TemplateBinding ActualForeground}" VerticalAlignment="Center" />
                            </StackPanel>
                            <StackPanel x:Name="SmallView" DataContext="{Binding RelativeSource={RelativeSource TemplatedParent},Converter={StaticResource commandConverter}}" Visibility="Collapsed" Orientation="Horizontal">
                                <ContentControl x:Name="SmallIconContainer" Content="{Binding Path=SmallIcon, RelativeSource={RelativeSource TemplatedParent}}" Foreground="{TemplateBinding ActualForeground}"/>
                                <ContentControl x:Name="SmallContentPresenter" Content="{TemplateBinding SmallContent}" ContentTemplate="{TemplateBinding SmallContentTemplate}" Foreground="{TemplateBinding ActualForeground}" VerticalAlignment="Center"/>
                            </StackPanel>

                            <ContentControl x:Name="ContentPresenter" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}" Visibility="Collapsed"
                                VerticalAlignment="{TemplateBinding VerticalContentAlignment}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Foreground="{TemplateBinding ActualForeground}"/>
                        </Grid>
                        <Border x:Name="DisabledVisualElement" Background="{StaticResource DisabledBrush}" IsHitTestVisible="False" Visibility="Collapsed" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="c1tb:C1ToolbarItem" BasedOn="{StaticResource C1.Silverlight.Toolbar.C1ToolbarItem}" />
</ResourceDictionary>