<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation">

    <ControlTemplate x:Key="RadWindowTemplate" TargetType="telerik:RadWindow">
        <Grid x:Name="LayoutRoot">
            <VisualStateManager.VisualStateGroups>
                <VisualStateGroup x:Name="CommonStates">
                    <VisualState x:Name="Normal"/>
                    <VisualState x:Name="Disabled"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="FocusStates">
                    <VisualState x:Name="Focused"/>
                    <VisualState x:Name="Unfocused"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="DragStates">
                    <VisualState x:Name="NotDragging"/>
                    <VisualState x:Name="Dragging"/>
                    <VisualState x:Name="Resizing"/>
                </VisualStateGroup>
                <VisualStateGroup x:Name="WindowStates">
                    <VisualState x:Name="NormalWindow"/>
                    <VisualState x:Name="MaximizedRestricted"/>
                    <VisualState x:Name="Maximized">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="Header" Storyboard.TargetProperty="Margin">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>-1 0 -1 0</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentOuterBorder" Storyboard.TargetProperty="Margin">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>0</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="WindowOuterBorder" Storyboard.TargetProperty="BorderThickness">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>0</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="WindowOuterBorder" Storyboard.TargetProperty="Margin">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>0</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderButtons" Storyboard.TargetProperty="Margin">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>0 0 3 0</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                    <VisualState x:Name="Minimized">
                        <Storyboard>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="ContentOuterBorder" Storyboard.TargetProperty="Margin">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>0</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="HeaderButtons" Storyboard.TargetProperty="Margin">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <Thickness>0 0 3 0</Thickness>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="HorizontalAlignment">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <HorizontalAlignment>Left</HorizontalAlignment>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                            <ObjectAnimationUsingKeyFrames Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="VerticalAlignment">
                                <DiscreteObjectKeyFrame KeyTime="0">
                                    <DiscreteObjectKeyFrame.Value>
                                        <VerticalAlignment>Top</VerticalAlignment>
                                    </DiscreteObjectKeyFrame.Value>
                                </DiscreteObjectKeyFrame>
                            </ObjectAnimationUsingKeyFrames>
                        </Storyboard>
                    </VisualState>
                </VisualStateGroup>
            </VisualStateManager.VisualStateGroups>
            <Grid Opacity="0.3">
                <Rectangle Margin="1 1 -1 -1" Opacity="0.05" Stroke="Black" StrokeThickness="1" RadiusX="4" RadiusY="3"/>
                <Rectangle Margin="1 1 0 0" Opacity="0.1" Stroke="Black" StrokeThickness="1" RadiusX="3" RadiusY="2"/>
                <Rectangle Margin="2 2 1 1" Fill="Black" RadiusX="2" RadiusY="1" Opacity="0.3" StrokeThickness="1"/>
            </Grid>
            <Border x:Name="WindowOuterBorder" Grid.RowSpan="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Margin="0 0 2 2">
                <AdornerDecorator>
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" MinHeight="28"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <Grid x:Name="Header" Background="{telerik:VisualStudio2013Resource ResourceKey=HeaderBrush}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <Thumb x:Name="titleThumb" Grid.ColumnSpan="2" Style="{StaticResource WindowResizeThumbStyle}"/>
                            <Grid Grid.Column="0" Margin="4 0 4 0">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>
                                <ContentPresenter x:Name="IconContent"
                                        Grid.Column="0"
                                        HorizontalAlignment="Left"
                                        VerticalAlignment="Center"
                                        Content="{TemplateBinding Icon}"
                                        ContentTemplate="{TemplateBinding IconTemplate}"
                                        Margin="2"/>
                                <ContentControl x:Name="HeaderContent"
                                        Grid.Column="1"
                                        IsTabStop="False"
                                        HorizontalAlignment="Stretch"
                                        VerticalAlignment="Center"
                                        HorizontalContentAlignment="Stretch"
                                        Content="{TemplateBinding Header}"
                                        ContentTemplate="{TemplateBinding HeaderTemplate}"
                                        SnapsToDevicePixels="True"
                                        ContentTemplateSelector="{TemplateBinding HeaderTemplateSelector}"
                                        FontSize="{telerik:VisualStudio2013Resource ResourceKey=FontSize}"
                                        FontFamily="{telerik:VisualStudio2013Resource ResourceKey=FontFamily}"
                                        Foreground="{telerik:VisualStudio2013Resource ResourceKey=SelectedBrush}"/>
                            </Grid>
                            <Border x:Name="PART_HeaderButtonsBorder" Grid.Column="1">
                                <StackPanel x:Name="HeaderButtons" Grid.Column="1" Orientation="Horizontal" Margin="0 0 6 0">
                                    <telerik:RadButton x:Name="PART_MinimizeButton"
                                            Command="{x:Static telerik:WindowCommands.Minimize}"
                                            Style="{StaticResource WindowButtonStyle}"
                                            Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BooleanToVisibilityConverter}}">
                                        <ToolTipService.ToolTip>
                                            <ToolTip telerik:LocalizationManager.ResourceKey="Minimize"/>
                                        </ToolTipService.ToolTip>
                                        <Path Data="M0,0 L10,0 L10,2 L0,2 z" Height="2" Width="10" VerticalAlignment="Bottom" Margin="0 0 0 4" Fill="{telerik:VisualStudio2013Resource ResourceKey=SelectedBrush}"/>
                                    </telerik:RadButton>
                                    <telerik:RadButton x:Name="PART_RestoreButton"
                                            Command="{x:Static telerik:WindowCommands.Restore}"
                                            Style="{StaticResource WindowButtonStyle}"
                                            Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BooleanToVisibilityConverter}}">
                                        <ToolTipService.ToolTip>
                                            <ToolTip telerik:LocalizationManager.ResourceKey="Restore"/>
                                        </ToolTipService.ToolTip>
                                        <Path
                                                Fill="{telerik:VisualStudio2013Resource ResourceKey=SelectedBrush}"
                                                Width="10"
                                                Height="10"
                                                Data="M1,5 L1,9 L7,9 L7,5 z M3,2 L3,3 L8,3 L8,6 L9,6 L9,2 z M2,0 L10,0 L10,7 L8,7 L8,10 L0,10 L0,3 L2,3 z"/>
                                    </telerik:RadButton>
                                    <telerik:RadButton x:Name="PART_MaximizeButton"
                                            Command="{x:Static telerik:WindowCommands.Maximize}"
                                            Style="{StaticResource WindowButtonStyle}"
                                            Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BooleanToVisibilityConverter}}">
                                        <ToolTipService.ToolTip>
                                            <ToolTip telerik:LocalizationManager.ResourceKey="Maximize"/>
                                        </ToolTipService.ToolTip>
                                        <Path Fill="{telerik:VisualStudio2013Resource ResourceKey=SelectedBrush}" Width="10" Height="10" Data="M0,0 L10,0 10,10 0,10 z M1,3 L9,3 9,9 1,9 z"/>
                                    </telerik:RadButton>
                                    <telerik:RadButton x:Name="PART_CloseButton"
                                            Command="{x:Static telerik:WindowCommands.Close}"
                                            Style="{StaticResource WindowButtonStyle}"
                                            Visibility="{Binding IsEnabled, RelativeSource={RelativeSource Self}, Converter={StaticResource BooleanToVisibilityConverter}}">
                                        <ToolTipService.ToolTip>
                                            <ToolTip telerik:LocalizationManager.ResourceKey="Close"/>
                                        </ToolTipService.ToolTip>
                                        <Path
                                                Fill="{telerik:VisualStudio2013Resource ResourceKey=SelectedBrush}"
                                                Width="10"
                                                Height="10"
                                                Data="M1,0 L5,4 L9,0 L10,1 L6,5 L10,9 L9,10 L5,6 L1,10 L0,9 L4,5 L0,1 z"
                                                Stretch="Fill"/>
                                    </telerik:RadButton>
                                </StackPanel>
                            </Border>
                        </Grid>
                        <Border x:Name="ContentOuterBorder"
                                Grid.Row="1"
                                BorderThickness="0 1 0 0"
                                BorderBrush="{telerik:VisualStudio2013Resource ResourceKey=BasicBrush}"
                                Background="{TemplateBinding Background}">
                            <ContentPresenter x:Name="ContentElement" Margin="{TemplateBinding Padding}" Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"/>
                        </Border>
                    </Grid>
                </AdornerDecorator>
            </Border>
        </Grid>
    </ControlTemplate>
    <Style TargetType="telerik:RadWindow" BasedOn="{StaticResource RadWindowStyle}">
        <Setter Property="BorderBrush" Value="{telerik:VisualStudio2013Resource ResourceKey=AccentBrush}" />
        <Setter Property="BorderThickness" Value="1"/>
        <Setter Property="Template" Value="{StaticResource RadWindowTemplate}"/>
    </Style>
</ResourceDictionary>