This is a migrated thread and some comments may be shown as answers.

Desktop Alert acting weird after changing template

3 Answers 163 Views
DesktopAlert
This is a migrated thread and some comments may be shown as answers.
Sayyed Hossein
Top achievements
Rank 1
Sayyed Hossein asked on 18 Jan 2017, 11:21 AM

this is what I do

1- right click on a rad desktop alert(with windows 8 touch theme) and select edit template->edit a copy

2- name the new style as "newstyle"

3- set the DesktopAlertStyle property of DAP(DesktopAlertParameters) to this style

4- set the ShowMenuButton property of DAP(DesktopAlertParameters) to false

4- alertmanager.ShowAlert(DAP)

 

now the alert that is shown has all the style that it has to have BUT it shows the Menubutton eventhough it shouldn't! and even if we set the showmenubutton property to true and add a couple of menus, after this styling those menus are not shown it seems that there is no binding between the dropdownbutton in the header and the properties of desktopalertitem itself

3 Answers, 1 is accepted

Sort by
0
Sayyed Hossein
Top achievements
Rank 1
answered on 18 Jan 2017, 11:35 AM

although its the actual defaultsyle of windows8touchtheme I thought putting it here might help

 

<Style x:Key="NewAlertStyle" TargetType="{x:Type telerik:RadDesktopAlert}">
    <Setter Property="Padding" Value="10,8"/>
    <Setter Property="Opacity" Value="0.9"/>
    <Setter Property="SnapsToDevicePixels" Value="True"/>
    <Setter Property="FontFamily" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.FontFamily}}"/>
    <Setter Property="FontSize" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.FontSizeL}}"/>
    <Setter Property="Foreground" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.InvertedForegroundBrush}}"/>
    <Setter Property="Background" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.AccentBrush}}"/>
    <Setter Property="Width" Value="410"/>
    <Setter Property="Height" Value="140"/>
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="{x:Type telerik:RadDesktopAlert}">
                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                    <Grid Margin="{TemplateBinding Padding}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="*"/>
                        </Grid.RowDefinitions>
                        <ContentPresenter ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Grid.Column="1" TextElement.Foreground="{TemplateBinding Foreground}" Grid.Row="0" VerticalAlignment="Top"/>
                        <ContentPresenter x:Name="Icon" ContentTemplate="{TemplateBinding IconTemplate}" Content="{TemplateBinding Icon}" Grid.Column="0" HorizontalAlignment="Center" Margin="{TemplateBinding IconMargin}" Grid.RowSpan="2" VerticalAlignment="Center" Width="{TemplateBinding IconColumnWidth}"/>
                        <ContentPresenter x:Name="Content" Cursor="Hand" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="1" ContentStringFormat="{TemplateBinding ContentStringFormat}" TextElement.Foreground="{TemplateBinding Foreground}" telerik:WindowHost.HitTestable="True" HorizontalAlignment="Left" Margin="0,7,0,0" Grid.Row="1" VerticalAlignment="Top">
                            <ContentPresenter.Resources>
                                <Style x:Key="{x:Type TextBlock}" TargetType="{x:Type TextBlock}">
                                    <Setter Property="TextWrapping" Value="Wrap"/>
                                    <Setter Property="TextTrimming" Value="CharacterEllipsis"/>
                                    <Style.Triggers>
                                        <Trigger Property="IsMouseOver" Value="True">
                                            <Setter Property="TextDecorations" Value="Underline"/>
                                        </Trigger>
                                    </Style.Triggers>
                                </Style>
                            </ContentPresenter.Resources>
                        </ContentPresenter>
                    </Grid>
                </Border>
                <ControlTemplate.Triggers>
                    <Trigger Property="IsMouseOverAlert" Value="True">
                        <Trigger.EnterActions>
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation Duration="0:0:0.5" To="1" Storyboard.TargetProperty="Opacity"/>
                                </Storyboard>
                            </BeginStoryboard>
                        </Trigger.EnterActions>
                        <Trigger.ExitActions>
                            <BeginStoryboard>
                                <Storyboard>
                                    <DoubleAnimation Duration="0:0:0.5" To="0.9" Storyboard.TargetProperty="Opacity"/>
                                </Storyboard>
                            </BeginStoryboard>
                        </Trigger.ExitActions>
                    </Trigger>
                </ControlTemplate.Triggers>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="HeaderTemplate">
        <Setter.Value>
            <DataTemplate>
                <Grid x:Name="Header" Grid.Column="1" Grid.Row="0" VerticalAlignment="Top">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto"/>
                        <RowDefinition Height="Auto"/>
                    </Grid.RowDefinitions>
                    <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Top">
                        <telerik:RadDropDownButton x:Name="DesktopAlert_DropDownButton" IsOpen="{Binding IsMenuOpen, Mode=TwoWay}" InnerCornerRadius="14">
                            <telerik:RadDropDownButton.DropDownContent>
                                <telerik:RadContextMenu ClickToOpen="True" ItemContainerStyle="{Binding MenuItemContainerStyle}"/>
                            </telerik:RadDropDownButton.DropDownContent>
                            <telerik:RadDropDownButton.Style>
                                <Style TargetType="{x:Type telerik:RadDropDownButton}">
                                    <Setter Property="Margin" Value="0,0,4,0"/>
                                    <Setter Property="Padding" Value="0"/>
                                    <Setter Property="SnapsToDevicePixels" Value="True"/>
                                    <Setter Property="FocusVisualStyle" Value="{x:Null}"/>
                                    <Setter Property="MinHeight" Value="30"/>
                                    <Setter Property="MinWidth" Value="30"/>
                                    <Setter Property="Foreground" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.InvertedForegroundBrush}}"/>
                                    <Setter Property="BorderBrush" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.InvertedForegroundBrush}}"/>
                                    <Setter Property="CornerRadius" Value="15"/>
                                    <Setter Property="BorderThickness" Value="2"/>
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="{x:Type telerik:RadDropDownButton}">
                                                <Grid SnapsToDevicePixels="True">
                                                    <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="Ellipse"/>
                                                                    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Content"/>
                                                                </Storyboard>
                                                            </VisualState>
                                                            <VisualState x:Name="Pressed">
                                                                <Storyboard/>
                                                            </VisualState>
                                                            <VisualState x:Name="Disabled">
                                                                <Storyboard>
                                                                    <DoubleAnimation Duration="0" To="0.3" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Ellipse"/>
                                                                    <DoubleAnimation Duration="0" To="0.3" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Content"/>
                                                                </Storyboard>
                                                            </VisualState>
                                                        </VisualStateGroup>
                                                        <VisualStateGroup x:Name="IsOpenState">
                                                            <VisualState x:Name="Closed"/>
                                                            <VisualState x:Name="Opened">
                                                                <Storyboard/>
                                                            </VisualState>
                                                        </VisualStateGroup>
                                                        <VisualStateGroup x:Name="FocusStatesGroup">
                                                            <VisualState x:Name="Unfocused"/>
                                                            <VisualState x:Name="Focused"/>
                                                        </VisualStateGroup>
                                                    </VisualStateManager.VisualStateGroups>
                                                    <Border x:Name="OuterPressedBorder" BorderBrush="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MediumBrush}}" BorderThickness="{TemplateBinding BorderThickness}" Background="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.InvertedGradientBrush}}" CornerRadius="{TemplateBinding CornerRadius}" Visibility="Collapsed"/>
                                                    <Border x:Name="CheckedVisual" BorderBrush="Transparent" BorderThickness="{TemplateBinding BorderThickness}" Background="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MainBrush}}" CornerRadius="{TemplateBinding CornerRadius}" Opacity="0"/>
                                                    <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                                                        <Grid.ColumnDefinitions>
                                                            <ColumnDefinition Width="Auto"/>
                                                            <ColumnDefinition Width="*"/>
                                                            <ColumnDefinition Width="Auto"/>
                                                        </Grid.ColumnDefinitions>
                                                        <Grid.RowDefinitions>
                                                            <RowDefinition Height="Auto"/>
                                                            <RowDefinition Height="*"/>
                                                            <RowDefinition Height="Auto"/>
                                                        </Grid.RowDefinitions>
                                                        <Grid x:Name="DropDownIndicator" Grid.Column="1" HorizontalAlignment="Center" IsHitTestVisible="False" Grid.Row="2" RenderTransformOrigin="0.5,0.5" Visibility="{TemplateBinding DropDownIndicatorVisibility}" VerticalAlignment="Center" Panel.ZIndex="2">
                                                            <Ellipse x:Name="Ellipse" Height="30" Opacity="0.6" Stretch="Fill" Stroke="{TemplateBinding Foreground}" StrokeThickness="2" Width="30"/>
                                                            <Path x:Name="Content" Data="M0,0L5,8 10,0z" Fill="{TemplateBinding Foreground}" HorizontalAlignment="Center" Opacity="0.6" VerticalAlignment="Center"/>
                                                        </Grid>
                                                    </Grid>
                                                    <Popup x:Name="DropDownPopup" AllowsTransparency="True" Focusable="False" Placement="Bottom" StaysOpen="False">
                                                        <Grid>
                                                            <Border x:Name="DropDownPopupBorder" BorderBrush="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MediumBrush}}" BorderThickness="1" Background="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MainBrush}}" Height="{TemplateBinding DropDownHeight}" MaxWidth="{TemplateBinding DropDownMaxWidth}" MaxHeight="{TemplateBinding DropDownMaxHeight}" MinWidth="3" MinHeight="3" Width="{TemplateBinding DropDownWidth}">
                                                                <ContentControl x:Name="DropDownPopupContent" ContentTemplate="{TemplateBinding DropDownContentTemplate}" Content="{TemplateBinding DropDownContent}" ContentStringFormat="{TemplateBinding ContentStringFormat}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" VerticalAlignment="Stretch" VerticalContentAlignment="Stretch"/>
                                                            </Border>
                                                        </Grid>
                                                    </Popup>
                                                </Grid>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </telerik:RadDropDownButton.Style>
                            <telerik:RadDropDownButton.Visibility>
                                <Binding Path="ShowMenuButton">
                                    <Binding.Converter>
                                        <telerik:BooleanToVisibilityConverter/>
                                    </Binding.Converter>
                                </Binding>
                            </telerik:RadDropDownButton.Visibility>
                        </telerik:RadDropDownButton>
                        <telerik:RadButton x:Name="DesktopAlert_CloseButton" Command="telerik:DesktopAlertCommands.Close" InnerCornerRadius="14">
                            <telerik:RadButton.Style>
                                <Style TargetType="{x:Type telerik:RadButton}">
                                    <Setter Property="IsTabStop" Value="False"/>
                                    <Setter Property="Padding" Value="0"/>
                                    <Setter Property="SnapsToDevicePixels" Value="True"/>
                                    <Setter Property="MinHeight" Value="30"/>
                                    <Setter Property="MinWidth" Value="30"/>
                                    <Setter Property="Foreground" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.InvertedForegroundBrush}}"/>
                                    <Setter Property="BorderBrush" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.InvertedForegroundBrush}}"/>
                                    <Setter Property="CornerRadius" Value="15"/>
                                    <Setter Property="BorderThickness" Value="2"/>
                                    <Setter Property="Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="{x:Type telerik:RadButton}">
                                                <Grid Background="Transparent">
                                                    <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="Ellipse"/>
                                                                    <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Content"/>
                                                                </Storyboard>
                                                            </VisualState>
                                                            <VisualState x:Name="Pressed">
                                                                <Storyboard/>
                                                            </VisualState>
                                                            <VisualState x:Name="Disabled">
                                                                <Storyboard>
                                                                    <DoubleAnimation Duration="0" To="0.3" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Ellipse"/>
                                                                    <DoubleAnimation Duration="0" To="0.3" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="Content"/>
                                                                </Storyboard>
                                                            </VisualState>
                                                        </VisualStateGroup>
                                                    </VisualStateManager.VisualStateGroups>
                                                    <Ellipse x:Name="Ellipse" Height="30" Opacity="0.6" Stretch="Fill" Stroke="{TemplateBinding Foreground}" StrokeThickness="2" Width="30"/>
                                                    <Path x:Name="Content" Data="F1M12.4,5.1L10.9,3.5 8,6.5 5,3.5 3.5,5.1 6.4,8 3.5,11 5,12.5 8,9.5 10.9,12.5 12.4,11 9.5,8z" Fill="{TemplateBinding Foreground}" Height="16" Opacity="0.6" Stretch="Fill" Width="16"/>
                                                </Grid>
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </telerik:RadButton.Style>
                            <telerik:RadButton.ToolTip>
                                <ToolTip Content="Close" telerik:LocalizationManager.ResourceKey="Close">
                                    <telerik:StyleManager.Theme>
                                        <telerik:Windows8TouchTheme/>
                                    </telerik:StyleManager.Theme>
                                </ToolTip>
                            </telerik:RadButton.ToolTip>
                            <telerik:RadButton.Visibility>
                                <Binding Path="ShowCloseButton">
                                    <Binding.Converter>
                                        <telerik:BooleanToVisibilityConverter/>
                                    </Binding.Converter>
                                </Binding>
                            </telerik:RadButton.Visibility>
                        </telerik:RadButton>
                    </StackPanel>
                    <ContentPresenter Content="{Binding}" TextElement.FontWeight="Bold" Margin="0,0,70,0" MinHeight="{Binding ActualHeight, ElementName=DesktopAlert_CloseButton}" Grid.RowSpan="2" VerticalAlignment="Top">
                        <ContentPresenter.Resources>
                            <Style x:Key="{x:Type TextBlock}" TargetType="{x:Type TextBlock}">
                                <Setter Property="TextWrapping" Value="Wrap"/>
                            </Style>
                        </ContentPresenter.Resources>
                    </ContentPresenter>
                </Grid>
            </DataTemplate>
        </Setter.Value>
    </Setter>
    <Setter Property="MenuItemContainerStyle">
        <Setter.Value>
            <Style TargetType="{x:Type telerik:RadMenuItem}">
                <Setter Property="Header" Value="{Binding Header}"/>
                <Setter Property="Command" Value="{Binding Command}"/>
                <Setter Property="CommandParameter" Value="{Binding CommandParameter}"/>
                <Setter Property="ItemsSource" Value="{Binding ItemsSource}"/>
                <Setter Property="IsSeparator" Value="{Binding IsSeparator}"/>
                <Setter Property="IsCheckable" Value="{Binding IsCheckable}"/>
                <Setter Property="IsChecked" Value="{Binding IsChecked}"/>
                <Setter Property="Icon" Value="{Binding IconUrl}"/>
                <Setter Property="IconTemplate">
                    <Setter.Value>
                        <DataTemplate>
                            <Image Source="{Binding}" Stretch="None"/>
                        </DataTemplate>
                    </Setter.Value>
                </Setter>
                <Style.BasedOn>
                    <Style TargetType="{x:Type telerik:RadMenuItem}">
                        <Setter Property="Padding" Value="12,6"/>
                        <Setter Property="Template">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type telerik:RadMenuItem}">
                                    <Grid x:Name="RootElement">
                                        <VisualStateManager.VisualStateGroups>
                                            <VisualStateGroup x:Name="CommonStates">
                                                <VisualState x:Name="SubMenuOpen">
                                                    <Storyboard>
                                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ExpandIconBottom"/>
                                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ExpandIconTop"/>
                                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightVisual"/>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Highlighted">
                                                    <Storyboard>
                                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightVisual"/>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentGrid"/>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Normal"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="FocusStates">
                                                <VisualState x:Name="Unfocused"/>
                                                <VisualState x:Name="Focused"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="CheckedStates">
                                                <VisualState x:Name="Checked">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Tick">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Icon">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Unchecked"/>
                                                <VisualState x:Name="HideIcon">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Icon">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="RoleStates">
                                                <VisualState x:Name="TopLevelItem">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Margin" Storyboard.TargetName="ContentGrid">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Thickness>5</Thickness>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="HighlightVisual">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <DoubleAnimation Duration="0" To="24" Storyboard.TargetProperty="MinWidth" Storyboard.TargetName="Icon"/>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Margin" Storyboard.TargetName="IconHost">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Thickness>-2,1,-5,1</Thickness>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="TopLevelHeader">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="HighlightVisual">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Margin" Storyboard.TargetName="ContentGrid">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Thickness>5</Thickness>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ExpandIcon">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ExpandIconRight">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ExpandIconTop">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ExpandIconBottom">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="HorizontalOffset" Storyboard.TargetName="PART_Popup"/>
                                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="VerticalOffset" Storyboard.TargetName="PART_Popup"/>
                                                        <DoubleAnimation Duration="0" To="24" Storyboard.TargetProperty="MinWidth" Storyboard.TargetName="Icon"/>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Margin" Storyboard.TargetName="IconHost">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Thickness>-2,1,-5,1</Thickness>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="SubmenuItem">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ButtonVisual">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="SubmenuHeader">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ButtonVisual">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ExpandIcon">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Separator"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="OrientationStates">
                                                <VisualState x:Name="Horizontal"/>
                                                <VisualState x:Name="Vertical"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="ChildrenStates">
                                                <VisualState x:Name="HasChildren"/>
                                                <VisualState x:Name="NoChildren"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="HeaderStates">
                                                <VisualState x:Name="VisibleHeader"/>
                                                <VisualState x:Name="EmptyHeader">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Margin" Storyboard.TargetName="Icon">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Thickness>5,3,4,3</Thickness>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Content">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="InputGestureTextStates">
                                                <VisualState x:Name="EmptyInputGestureText"/>
                                                <VisualState x:Name="VisibleInputGestureText">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_InputGestureText">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                        </VisualStateManager.VisualStateGroups>
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"/>
                                        <Rectangle x:Name="ButtonVisual" Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MainGradientBrush}}" Margin="3" Stroke="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MediumBrush}}" StrokeThickness="1"/>
                                        <Rectangle x:Name="HighlightVisual" Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.LowBrush}}" Margin="3" Opacity="0" StrokeThickness="1"/>
                                        <Grid x:Name="ContentGrid" Margin="3">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid x:Name="IconHost" Margin="-2,1,-1,1" Width="{TemplateBinding IconColumnWidth}">
                                                <Path x:Name="Tick" Data="M8,12.1L9.7,12.2 11.4,14.1 16,7.4 17.2,7 11.3,17.8z" Fill="{TemplateBinding Foreground}" FlowDirection="LeftToRight" Height="24" Margin="5,3,8,3" Visibility="Collapsed" Width="24"/>
                                                <ContentPresenter x:Name="Icon" ContentTemplate="{TemplateBinding IconTemplate}" Content="{TemplateBinding Icon}" Margin="5,3,8,3"/>
                                            </Grid>
                                            <ContentPresenter x:Name="Content" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                            <telerik:SharedSizeContentPresenter x:Name="PART_InputGestureText" Content="{TemplateBinding InputGestureText}" Grid.Column="2" Margin="40,6,6,6" SharedSizeGroupWidth="IGTColumn" Visibility="Collapsed"/>
                                            <telerik:SharedSizeContentPresenter Grid.Column="3" HorizontalAlignment="Right" SharedSizeGroupWidth="ExpandIconColumn">
                                                <Grid x:Name="ExpandIcon" Height="19" Margin="0,0,2,0" Visibility="Collapsed" Width="16">
                                                    <Path x:Name="ExpandIconRight" Data="M0,0L7.5,5 0,10z" Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MainForegroundBrush}}" Margin="4,4,5,4"/>
                                                    <Path x:Name="ExpandIconBottom" Data="M0,0L5,7.5 10,0z" Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.HighBrush}}" Margin="0,6,6,4" Visibility="Collapsed"/>
                                                    <Path x:Name="ExpandIconTop" Data="M0,8L5,0.5 10,8z" Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.HighBrush}}" Margin="0,6,6,4" Opacity="0" Visibility="Collapsed"/>
                                                </Grid>
                                            </telerik:SharedSizeContentPresenter>
                                        </Grid>
                                        <Popup x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" HorizontalOffset="-1" IsOpen="{TemplateBinding IsSubmenuOpen}" VerticalOffset="-1">
                                            <Grid Height="{TemplateBinding DropDownHeight}" Width="{TemplateBinding DropDownWidth}">
                                                <Grid x:Name="PopupContentElement">
                                                    <Border BorderBrush="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.LowBrush}}" BorderThickness="1" Background="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MainBrush}}">
                                                        <Grid>
                                                            <Grid HorizontalAlignment="Left" Width="{Binding IconColumnWidth, RelativeSource={RelativeSource TemplatedParent}}">
                                                                <Rectangle Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.LowBrush}}" HorizontalAlignment="Right" Width="1"/>
                                                            </Grid>
                                                            <ScrollViewer x:Name="PART_ScrollViewer" telerik:SharedSizeScope.IsSharedSizeScope="True">
                                                                <ScrollViewer.Style>
                                                                    <Style TargetType="{x:Type ScrollViewer}">
                                                                        <Setter Property="Padding" Value="0"/>
                                                                        <Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
                                                                        <Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
                                                                        <Setter Property="CanContentScroll" Value="True"/>
                                                                        <Setter Property="Template">
                                                                            <Setter.Value>
                                                                                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                                                                                    <Grid SnapsToDevicePixels="True">
                                                                                        <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Margin="{TemplateBinding Padding}"/>
                                                                                        <RepeatButton CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Command="ScrollBar.LineUpCommand" Focusable="False" VerticalAlignment="Top">
                                                                                            <RepeatButton.Style>
                                                                                                <Style TargetType="{x:Type RepeatButton}">
                                                                                                    <Setter Property="BorderThickness" Value="0,0,0,1"/>
                                                                                                    <Setter Property="Template">
                                                                                                        <Setter.Value>
                                                                                                            <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                                                                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                                                                                                                    <VisualStateManager.VisualStateGroups>
                                                                                                                        <VisualStateGroup x:Name="CommonStates">
                                                                                                                            <VisualState x:Name="Normal"/>
                                                                                                                            <VisualState x:Name="Pressed">
                                                                                                                                <Storyboard>
                                                                                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" Storyboard.TargetName="ContentContainer">
                                                                                                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                                                                                                            <DiscreteObjectKeyFrame.Value>
                                                                                                                                                <Thickness>1,3,1,1</Thickness>
                                                                                                                                            </DiscreteObjectKeyFrame.Value>
                                                                                                                                        </DiscreteObjectKeyFrame>
                                                                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                                                                </Storyboard>
                                                                                                                            </VisualState>
                                                                                                                            <VisualState x:Name="Disabled">
                                                                                                                                <Storyboard>
                                                                                                                                    <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentContainer"/>
                                                                                                                                </Storyboard>
                                                                                                                            </VisualState>
                                                                                                                        </VisualStateGroup>
                                                                                                                        <VisualStateGroup x:Name="FocusStates">
                                                                                                                            <VisualState x:Name="Focused"/>
                                                                                                                            <VisualState x:Name="Unfocused"/>
                                                                                                                        </VisualStateGroup>
                                                                                                                    </VisualStateManager.VisualStateGroups>
                                                                                                                    <Grid x:Name="ContentContainer" Margin="1,2">
                                                                                                                        <Path x:Name="Icon" Data="M0,4L3.5,0.5 7,4z" Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MainForegroundBrush}}" Height="4" Margin="1,4" Stretch="None" Width="7"/>
                                                                                                                    </Grid>
                                                                                                                </Border>
                                                                                                            </ControlTemplate>
                                                                                                        </Setter.Value>
                                                                                                    </Setter>
                                                                                                    <Style.BasedOn>
                                                                                                        <Style TargetType="{x:Type RepeatButton}">
                                                                                                            <Setter Property="Interval" Value="50"/>
                                                                                                            <Setter Property="IsTabStop" Value="False"/>
                                                                                                            <Setter Property="MinWidth" Value="0"/>
                                                                                                            <Setter Property="MinHeight" Value="0"/>
                                                                                                            <Setter Property="Background" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.LowBrush}}"/>
                                                                                                            <Setter Property="BorderBrush" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.MainBrush}}"/>
                                                                                                            <Setter Property="BorderThickness" Value="0"/>
                                                                                                            <Setter Property="ClickMode" Value="Hover"/>
                                                                                                        </Style>
                                                                                                    </Style.BasedOn>
                                                                                                </Style>
                                                                                            </RepeatButton.Style>
                                                                                            <RepeatButton.Visibility>
                                                                                                <MultiBinding ConverterParameter="0" FallbackValue="Visibility.Collapsed" UpdateSourceTrigger="Default">
                                                                                                    <MultiBinding.Converter>
                                                                                                        <MenuScrollingVisibilityConverter/>
                                                                                                    </MultiBinding.Converter>
                                                                                                    <Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                    <Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                    <Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                    <Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                </MultiBinding>
                                                                                            </RepeatButton.Visibility>
                                                                                        </RepeatButton>
                                                                                        <RepeatButton CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Command="ScrollBar.LineDownCommand" Focusable="False" VerticalAlignment="Bottom">
                                                                                            <RepeatButton.Style>
                                                                                                <Style TargetType="{x:Type RepeatButton}">
                                                                                                    <Setter Property="BorderThickness" Value="0,1,0,0"/>
                                                                                                    <Setter Property="Template">
                                                                                                        <Setter.Value>
                                                                                                            <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                                                                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                                                                                                                    <VisualStateManager.VisualStateGroups>
                                                                                                                        <VisualStateGroup x:Name="CommonStates">
                                                                                                                            <VisualState x:Name="Normal"/>
                                                                                                                            <VisualState x:Name="Pressed">
                                                                                                                                <Storyboard>
                                                                                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" Storyboard.TargetName="ContentContainer">
                                                                                                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                                                                                                            <DiscreteObjectKeyFrame.Value>
                                                                                                                                                <Thickness>1,3,1,1</Thickness>
                                                                                                                                            </DiscreteObjectKeyFrame.Value>
                                                                                                                                        </DiscreteObjectKeyFrame>
                                                                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                                                                </Storyboard>
                                                                                                                            </VisualState>
                                                                                                                            <VisualState x:Name="Disabled">
                                                                                                                                <Storyboard>
                                                                                                                                    <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentContainer"/>
                                                                                                                                </Storyboard>
                                                                                                                            </VisualState>
                                                                                                                        </VisualStateGroup>
                                                                                                                        <VisualStateGroup x:Name="FocusStates">
                                                                                                                            <VisualState x:Name="Focused"/>
                                                                                                                            <VisualState x:Name="Unfocused"/>
                                                                                                                        </VisualStateGroup>
                                                                                                                    </VisualStateManager.VisualStateGroups>
                                                                                                                    <Grid x:Name="ContentContainer" Margin="1,2">
                                                                                                                        <Path x:Name="Icon" Data="M0,0L3.5,3.5 7,0z" Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MainForegroundBrush}}" Height="4" Margin="1,4" Stretch="None" Width="7"/>
                                                                                                                    </Grid>
                                                                                                                </Border>
                                                                                                            </ControlTemplate>
                                                                                                        </Setter.Value>
                                                                                                    </Setter>
                                                                                                    <Style.BasedOn>
                                                                                                        <Style TargetType="{x:Type RepeatButton}">
                                                                                                            <Setter Property="Interval" Value="50"/>
                                                                                                            <Setter Property="IsTabStop" Value="False"/>
                                                                                                            <Setter Property="MinWidth" Value="0"/>
                                                                                                            <Setter Property="MinHeight" Value="0"/>
                                                                                                            <Setter Property="Background" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.LowBrush}}"/>
                                                                                                            <Setter Property="BorderBrush" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.MainBrush}}"/>
                                                                                                            <Setter Property="BorderThickness" Value="0"/>
                                                                                                            <Setter Property="ClickMode" Value="Hover"/>
                                                                                                        </Style>
                                                                                                    </Style.BasedOn>
                                                                                                </Style>
                                                                                            </RepeatButton.Style>
                                                                                            <RepeatButton.Visibility>
                                                                                                <MultiBinding ConverterParameter="100" FallbackValue="Visibility.Collapsed" UpdateSourceTrigger="Default">
                                                                                                    <MultiBinding.Converter>
                                                                                                        <MenuScrollingVisibilityConverter/>
                                                                                                    </MultiBinding.Converter>
                                                                                                    <Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                    <Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                    <Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                    <Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                </MultiBinding>
                                                                                            </RepeatButton.Visibility>
                                                                                        </RepeatButton>
                                                                                    </Grid>
                                                                                </ControlTemplate>
                                                                            </Setter.Value>
                                                                        </Setter>
                                                                        <Setter Property="PanningMode" Value="None"/>
                                                                    </Style>
                                                                </ScrollViewer.Style>
                                                                <Grid>
                                                                    <ItemsPresenter/>
                                                                </Grid>
                                                            </ScrollViewer>
                                                        </Grid>
                                                    </Border>
                                                </Grid>
                                            </Grid>
                                        </Popup>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                        <Setter Property="TopLevelHeaderTemplateKey">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type telerik:RadMenuItem}">
                                    <Grid x:Name="RootElement">
                                        <VisualStateManager.VisualStateGroups>
                                            <VisualStateGroup x:Name="CommonStates">
                                                <VisualState x:Name="SubMenuOpen">
                                                    <Storyboard>
                                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ExpandIconBottom"/>
                                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ExpandIconTop"/>
                                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightVisual"/>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Highlighted">
                                                    <Storyboard>
                                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightVisual"/>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentGrid"/>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Normal"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="FocusStates">
                                                <VisualState x:Name="Unfocused"/>
                                                <VisualState x:Name="Focused"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="CheckedStates">
                                                <VisualState x:Name="Checked">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Tick">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Icon">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Unchecked"/>
                                                <VisualState x:Name="HideIcon">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Icon">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="RoleStates">
                                                <VisualState x:Name="TopLevelItem">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Margin" Storyboard.TargetName="ContentGrid">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Thickness>5</Thickness>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="HighlightVisual">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <DoubleAnimation Duration="0" To="24" Storyboard.TargetProperty="MinWidth" Storyboard.TargetName="Icon"/>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Margin" Storyboard.TargetName="IconHost">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Thickness>-2,1,-5,1</Thickness>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="TopLevelHeader">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="HighlightVisual">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Margin" Storyboard.TargetName="ContentGrid">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Thickness>5</Thickness>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ExpandIcon">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ExpandIconRight">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ExpandIconTop">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ExpandIconBottom">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="HorizontalOffset" Storyboard.TargetName="PART_Popup"/>
                                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="VerticalOffset" Storyboard.TargetName="PART_Popup"/>
                                                        <DoubleAnimation Duration="0" To="24" Storyboard.TargetProperty="MinWidth" Storyboard.TargetName="Icon"/>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Margin" Storyboard.TargetName="IconHost">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Thickness>-2,1,-5,1</Thickness>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="SubmenuItem">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ButtonVisual">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="SubmenuHeader">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ButtonVisual">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="ExpandIcon">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Separator"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="OrientationStates">
                                                <VisualState x:Name="Horizontal"/>
                                                <VisualState x:Name="Vertical"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="ChildrenStates">
                                                <VisualState x:Name="HasChildren"/>
                                                <VisualState x:Name="NoChildren"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="HeaderStates">
                                                <VisualState x:Name="VisibleHeader"/>
                                                <VisualState x:Name="EmptyHeader">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Margin" Storyboard.TargetName="Icon">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Thickness>5,3,4,3</Thickness>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Content">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Collapsed</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="InputGestureTextStates">
                                                <VisualState x:Name="EmptyInputGestureText"/>
                                                <VisualState x:Name="VisibleInputGestureText">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="PART_InputGestureText">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                    </Storyboard>
                                                </VisualState>
                                            </VisualStateGroup>
                                        </VisualStateManager.VisualStateGroups>
                                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}"/>
                                        <Rectangle x:Name="ButtonVisual" Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MainGradientBrush}}" Margin="3" Stroke="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MediumBrush}}" StrokeThickness="1"/>
                                        <Rectangle x:Name="HighlightVisual" Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.LowBrush}}" Margin="3" Opacity="0" StrokeThickness="1"/>
                                        <Grid x:Name="ContentGrid" Margin="3">
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="*"/>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="Auto"/>
                                            </Grid.ColumnDefinitions>
                                            <Grid x:Name="IconHost" Margin="-2,1,-1,1" Width="{TemplateBinding IconColumnWidth}">
                                                <Path x:Name="Tick" Data="M8,12.1L9.7,12.2 11.4,14.1 16,7.4 17.2,7 11.3,17.8z" Fill="{TemplateBinding Foreground}" FlowDirection="LeftToRight" Height="24" Margin="5,3,8,3" Visibility="Collapsed" Width="24"/>
                                                <ContentPresenter x:Name="Icon" ContentTemplate="{TemplateBinding IconTemplate}" Content="{TemplateBinding Icon}" Margin="5,3,8,3"/>
                                            </Grid>
                                            <ContentPresenter x:Name="Content" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Grid.Column="1" ContentStringFormat="{TemplateBinding HeaderStringFormat}" ContentSource="Header" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/>
                                            <telerik:SharedSizeContentPresenter x:Name="PART_InputGestureText" Content="{TemplateBinding InputGestureText}" Grid.Column="2" Margin="40,6,6,6" SharedSizeGroupWidth="IGTColumn" Visibility="Collapsed"/>
                                            <telerik:SharedSizeContentPresenter Grid.Column="3" HorizontalAlignment="Right" SharedSizeGroupWidth="ExpandIconColumn">
                                                <Grid x:Name="ExpandIcon" Height="19" Margin="0,0,2,0" Visibility="Collapsed" Width="16">
                                                    <Path x:Name="ExpandIconRight" Data="M0,0L7.5,5 0,10z" Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MainForegroundBrush}}" Margin="4,4,5,4"/>
                                                    <Path x:Name="ExpandIconBottom" Data="M0,0L5,7.5 10,0z" Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.HighBrush}}" Margin="0,6,6,4" Visibility="Collapsed"/>
                                                    <Path x:Name="ExpandIconTop" Data="M0,8L5,0.5 10,8z" Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.HighBrush}}" Margin="0,6,6,4" Opacity="0" Visibility="Collapsed"/>
                                                </Grid>
                                            </telerik:SharedSizeContentPresenter>
                                        </Grid>
                                        <Popup x:Name="PART_Popup" AllowsTransparency="True" Focusable="False" HorizontalOffset="-1" IsOpen="{TemplateBinding IsSubmenuOpen}" VerticalOffset="-1">
                                            <Grid Height="{TemplateBinding DropDownHeight}" Width="{TemplateBinding DropDownWidth}">
                                                <Grid x:Name="PopupContentElement">
                                                    <Border BorderBrush="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.LowBrush}}" BorderThickness="1" Background="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MainBrush}}">
                                                        <Grid>
                                                            <Grid HorizontalAlignment="Left" Width="{Binding IconColumnWidth, RelativeSource={RelativeSource TemplatedParent}}">
                                                                <Rectangle Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.LowBrush}}" HorizontalAlignment="Right" Width="1"/>
                                                            </Grid>
                                                            <ScrollViewer x:Name="PART_ScrollViewer" telerik:SharedSizeScope.IsSharedSizeScope="True">
                                                                <ScrollViewer.Style>
                                                                    <Style TargetType="{x:Type ScrollViewer}">
                                                                        <Setter Property="Padding" Value="0"/>
                                                                        <Setter Property="HorizontalScrollBarVisibility" Value="Hidden"/>
                                                                        <Setter Property="VerticalScrollBarVisibility" Value="Auto"/>
                                                                        <Setter Property="CanContentScroll" Value="True"/>
                                                                        <Setter Property="Template">
                                                                            <Setter.Value>
                                                                                <ControlTemplate TargetType="{x:Type ScrollViewer}">
                                                                                    <Grid SnapsToDevicePixels="True">
                                                                                        <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" ContentStringFormat="{TemplateBinding ContentStringFormat}" Margin="{TemplateBinding Padding}"/>
                                                                                        <RepeatButton CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Command="ScrollBar.LineUpCommand" Focusable="False" VerticalAlignment="Top">
                                                                                            <RepeatButton.Style>
                                                                                                <Style TargetType="{x:Type RepeatButton}">
                                                                                                    <Setter Property="BorderThickness" Value="0,0,0,1"/>
                                                                                                    <Setter Property="Template">
                                                                                                        <Setter.Value>
                                                                                                            <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                                                                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                                                                                                                    <VisualStateManager.VisualStateGroups>
                                                                                                                        <VisualStateGroup x:Name="CommonStates">
                                                                                                                            <VisualState x:Name="Normal"/>
                                                                                                                            <VisualState x:Name="Pressed">
                                                                                                                                <Storyboard>
                                                                                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" Storyboard.TargetName="ContentContainer">
                                                                                                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                                                                                                            <DiscreteObjectKeyFrame.Value>
                                                                                                                                                <Thickness>1,3,1,1</Thickness>
                                                                                                                                            </DiscreteObjectKeyFrame.Value>
                                                                                                                                        </DiscreteObjectKeyFrame>
                                                                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                                                                </Storyboard>
                                                                                                                            </VisualState>
                                                                                                                            <VisualState x:Name="Disabled">
                                                                                                                                <Storyboard>
                                                                                                                                    <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentContainer"/>
                                                                                                                                </Storyboard>
                                                                                                                            </VisualState>
                                                                                                                        </VisualStateGroup>
                                                                                                                        <VisualStateGroup x:Name="FocusStates">
                                                                                                                            <VisualState x:Name="Focused"/>
                                                                                                                            <VisualState x:Name="Unfocused"/>
                                                                                                                        </VisualStateGroup>
                                                                                                                    </VisualStateManager.VisualStateGroups>
                                                                                                                    <Grid x:Name="ContentContainer" Margin="1,2">
                                                                                                                        <Path x:Name="Icon" Data="M0,4L3.5,0.5 7,4z" Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MainForegroundBrush}}" Height="4" Margin="1,4" Stretch="None" Width="7"/>
                                                                                                                    </Grid>
                                                                                                                </Border>
                                                                                                            </ControlTemplate>
                                                                                                        </Setter.Value>
                                                                                                    </Setter>
                                                                                                    <Style.BasedOn>
                                                                                                        <Style TargetType="{x:Type RepeatButton}">
                                                                                                            <Setter Property="Interval" Value="50"/>
                                                                                                            <Setter Property="IsTabStop" Value="False"/>
                                                                                                            <Setter Property="MinWidth" Value="0"/>
                                                                                                            <Setter Property="MinHeight" Value="0"/>
                                                                                                            <Setter Property="Background" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.LowBrush}}"/>
                                                                                                            <Setter Property="BorderBrush" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.MainBrush}}"/>
                                                                                                            <Setter Property="BorderThickness" Value="0"/>
                                                                                                            <Setter Property="ClickMode" Value="Hover"/>
                                                                                                        </Style>
                                                                                                    </Style.BasedOn>
                                                                                                </Style>
                                                                                            </RepeatButton.Style>
                                                                                            <RepeatButton.Visibility>
                                                                                                <MultiBinding ConverterParameter="0" FallbackValue="Visibility.Collapsed" UpdateSourceTrigger="Default">
                                                                                                    <MultiBinding.Converter>
                                                                                                        <MenuScrollingVisibilityConverter/>
                                                                                                    </MultiBinding.Converter>
                                                                                                    <Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                    <Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                    <Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                    <Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                </MultiBinding>
                                                                                            </RepeatButton.Visibility>
                                                                                        </RepeatButton>
                                                                                        <RepeatButton CommandTarget="{Binding RelativeSource={RelativeSource TemplatedParent}}" Command="ScrollBar.LineDownCommand" Focusable="False" VerticalAlignment="Bottom">
                                                                                            <RepeatButton.Style>
                                                                                                <Style TargetType="{x:Type RepeatButton}">
                                                                                                    <Setter Property="BorderThickness" Value="0,1,0,0"/>
                                                                                                    <Setter Property="Template">
                                                                                                        <Setter.Value>
                                                                                                            <ControlTemplate TargetType="{x:Type RepeatButton}">
                                                                                                                <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}">
                                                                                                                    <VisualStateManager.VisualStateGroups>
                                                                                                                        <VisualStateGroup x:Name="CommonStates">
                                                                                                                            <VisualState x:Name="Normal"/>
                                                                                                                            <VisualState x:Name="Pressed">
                                                                                                                                <Storyboard>
                                                                                                                                    <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Margin" Storyboard.TargetName="ContentContainer">
                                                                                                                                        <DiscreteObjectKeyFrame KeyTime="0">
                                                                                                                                            <DiscreteObjectKeyFrame.Value>
                                                                                                                                                <Thickness>1,3,1,1</Thickness>
                                                                                                                                            </DiscreteObjectKeyFrame.Value>
                                                                                                                                        </DiscreteObjectKeyFrame>
                                                                                                                                    </ObjectAnimationUsingKeyFrames>
                                                                                                                                </Storyboard>
                                                                                                                            </VisualState>
                                                                                                                            <VisualState x:Name="Disabled">
                                                                                                                                <Storyboard>
                                                                                                                                    <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentContainer"/>
                                                                                                                                </Storyboard>
                                                                                                                            </VisualState>
                                                                                                                        </VisualStateGroup>
                                                                                                                        <VisualStateGroup x:Name="FocusStates">
                                                                                                                            <VisualState x:Name="Focused"/>
                                                                                                                            <VisualState x:Name="Unfocused"/>
                                                                                                                        </VisualStateGroup>
                                                                                                                    </VisualStateManager.VisualStateGroups>
                                                                                                                    <Grid x:Name="ContentContainer" Margin="1,2">
                                                                                                                        <Path x:Name="Icon" Data="M0,0L3.5,3.5 7,0z" Fill="{DynamicResource {x:Static telerik:Windows8TouchResourceKey.MainForegroundBrush}}" Height="4" Margin="1,4" Stretch="None" Width="7"/>
                                                                                                                    </Grid>
                                                                                                                </Border>
                                                                                                            </ControlTemplate>
                                                                                                        </Setter.Value>
                                                                                                    </Setter>
                                                                                                    <Style.BasedOn>
                                                                                                        <Style TargetType="{x:Type RepeatButton}">
                                                                                                            <Setter Property="Interval" Value="50"/>
                                                                                                            <Setter Property="IsTabStop" Value="False"/>
                                                                                                            <Setter Property="MinWidth" Value="0"/>
                                                                                                            <Setter Property="MinHeight" Value="0"/>
                                                                                                            <Setter Property="Background" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.LowBrush}}"/>
                                                                                                            <Setter Property="BorderBrush" Value="{telerik:Windows8TouchResource ResourceKey={x:Static telerik:Windows8TouchResourceKey.MainBrush}}"/>
                                                                                                            <Setter Property="BorderThickness" Value="0"/>
                                                                                                            <Setter Property="ClickMode" Value="Hover"/>
                                                                                                        </Style>
                                                                                                    </Style.BasedOn>
                                                                                                </Style>
                                                                                            </RepeatButton.Style>
                                                                                            <RepeatButton.Visibility>
                                                                                                <MultiBinding ConverterParameter="100" FallbackValue="Visibility.Collapsed" UpdateSourceTrigger="Default">
                                                                                                    <MultiBinding.Converter>
                                                                                                        <MenuScrollingVisibilityConverter/>
                                                                                                    </MultiBinding.Converter>
                                                                                                    <Binding Path="ComputedVerticalScrollBarVisibility" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                    <Binding Path="VerticalOffset" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                    <Binding Path="ExtentHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                    <Binding Path="ViewportHeight" RelativeSource="{RelativeSource TemplatedParent}"/>
                                                                                                </MultiBinding>
                                                                                            </RepeatButton.Visibility>
                                                                                        </RepeatButton>
                                                                                    </Grid>
                                                                                </ControlTemplate>
                                                                            </Setter.Value>
                                                                        </Setter>
                                                                        <Setter Property="PanningMode" Value="None"/>
                                                                    </Style>
                                                                </ScrollViewer.Style>
                                                                <Grid>
                                                                    <ItemsPresenter/>
                                                                </Grid>
                                                            </ScrollViewer>
                                                        </Grid>
                                                    </Border>
                                                </Grid>
                                            </Grid>
                                        </Popup>
                                    </Grid>
                                </ControlTemplate>
                            </Setter.Value>
                        </Setter>
                        <Setter Property="TopLevelItemTemplateKey">
                            <Setter.Value>
                                <ControlTemplate TargetType="{x:Type telerik:RadMenuItem}">
                                    <Grid x:Name="RootElement">
                                        <VisualStateManager.VisualStateGroups>
                                            <VisualStateGroup x:Name="CommonStates">
                                                <VisualState x:Name="SubMenuOpen">
                                                    <Storyboard>
                                                        <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ExpandIconBottom"/>
                                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ExpandIconTop"/>
                                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightVisual"/>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Highlighted">
                                                    <Storyboard>
                                                        <DoubleAnimation Duration="0" To="1" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="HighlightVisual"/>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Disabled">
                                                    <Storyboard>
                                                        <DoubleAnimation Duration="0" To="0.5" Storyboard.TargetProperty="Opacity" Storyboard.TargetName="ContentGrid"/>
                                                    </Storyboard>
                                                </VisualState>
                                                <VisualState x:Name="Normal"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="FocusStates">
                                                <VisualState x:Name="Unfocused"/>
                                                <VisualState x:Name="Focused"/>
                                            </VisualStateGroup>
                                            <VisualStateGroup x:Name="CheckedStates">
                                                <VisualState x:Name="Checked">
                                                    <Storyboard>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Tick">
                                                            <DiscreteObjectKeyFrame KeyTime="0">
                                                                <DiscreteObjectKeyFrame.Value>
                                                                    <Visibility>Visible</Visibility>
                                                                </DiscreteObjectKeyFrame.Value>
                                                            </DiscreteObjectKeyFrame>
                                                        </ObjectAnimationUsingKeyFrames>
                                                        <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetProperty="Visibility" Storyboard.TargetName="Icon">
                                                            <