Rishabh876
Rishabh876

Reputation: 3180

How to disable ZoomOut effect in MenuFlyout

In silverlight the context menu used to have a property IsZoomEnabled that use to define whether zoom out effect will be there when ContextMenu shows up but in winrt xaml we have MenuFlyout which does not have any such property. How should I disable this effect?

Here is the default template for MenuFlyout

<!-- Default style for Windows.UI.Xaml.Controls.MenuFlyoutPresenter -->
<Style TargetType="MenuFlyoutPresenter">
    <Setter Property="RequestedTheme" Value="Light" />
    <Setter Property="Background" Value="{ThemeResource FlyoutBackgroundThemeBrush}" />
    <Setter Property="BorderBrush" Value="{ThemeResource FlyoutBorderThemeBrush}" />
    <Setter Property="BorderThickness" Value="{ThemeResource FlyoutBorderThemeThickness}" />
    <Setter Property="Padding" Value="{ThemeResource MenuFlyoutPresenterThemePadding}" />
    <Setter Property="ScrollViewer.HorizontalScrollMode" Value="Disabled" />
    <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Disabled" />
    <Setter Property="ScrollViewer.VerticalScrollMode" Value="Auto" />
    <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto" />
    <Setter Property="ScrollViewer.IsHorizontalRailEnabled" Value="False" />
    <Setter Property="ScrollViewer.IsVerticalRailEnabled" Value="False" />
    <Setter Property="ScrollViewer.ZoomMode" Value="Disabled" />
    <Setter Property="MinWidth" Value="{ThemeResource FlyoutThemeMinWidth}" />
    <Setter Property="MaxWidth" Value="{ThemeResource FlyoutThemeMaxWidth}" />
    <Setter Property="MinHeight" Value="{ThemeResource FlyoutThemeMinHeight}" />
    <Setter Property="MaxHeight" Value="{ThemeResource FlyoutThemeMaxHeight}" />
    <Setter Property="Template">
        <Setter.Value>
            <ControlTemplate TargetType="MenuFlyoutPresenter">
                <Border Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}">
                    <ScrollViewer Padding="{TemplateBinding Padding}"
                                  HorizontalScrollMode="{TemplateBinding ScrollViewer.HorizontalScrollMode}"
                                  HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
                                  VerticalScrollMode="{TemplateBinding ScrollViewer.VerticalScrollMode}"
                                  VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}"
                                  IsHorizontalRailEnabled="{TemplateBinding ScrollViewer.IsHorizontalRailEnabled}"
                                  IsVerticalRailEnabled="{TemplateBinding ScrollViewer.IsVerticalRailEnabled}"
                                  ZoomMode="{TemplateBinding ScrollViewer.ZoomMode}"
                                  AutomationProperties.AccessibilityView="Raw">
                        <ItemsPresenter />
                    </ScrollViewer>
                </Border>
            </ControlTemplate>
        </Setter.Value>
    </Setter>
</Style>

Upvotes: 1

Views: 162

Answers (1)

Kristian Vukusic
Kristian Vukusic

Reputation: 3324

You can't accomplish this in WinRT. You can create your own UserControl or replicate the behavior of a MenuFlyout using only a Flyout. Try this tutorial if you want to do something like this.

Upvotes: 0

Related Questions