MenuFlyoutPresenter MenuFlyoutPresenter MenuFlyoutPresenter Class

Definition

Displays the content of a MenuFlyout control.

public class MenuFlyoutPresenter : ItemsControl, IMenuFlyoutPresenter, IMenuFlyoutPresenter2public class MenuFlyoutPresenter : ItemsControl, IMenuFlyoutPresenter, IMenuFlyoutPresenter2Public Class MenuFlyoutPresenter Inherits ItemsControl Implements IMenuFlyoutPresenter, IMenuFlyoutPresenter2
Inheritance
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

Inherited Members

Inherited properties

Inherited events

Inherited methods

Remarks

You don't typically use a MenuFlyoutPresenter directly, either in XAML or code. Instead, you reference the MenuFlyoutPresenter type as the TargetType of the style you use for the MenuFlyout.MenuFlyoutPresenterStyle property. Then, you use style Setter elements to set the various Control properties that influence the appearance of the MenuFlyout through this presenter. For example you can use a Setter to set the Width of the MenuFlyout:

<MenuFlyout x:Name="optionFlyout">
  <MenuFlyout.MenuFlyoutPresenterStyle>
    <Style TargetType="MenuFlyoutPresenter">
      <Setter Property="Width" Value="300"/>
    </Style>
  </MenuFlyout.MenuFlyoutPresenterStyle>
<!--menu items go here-->
</MenuFlyout>

The MenuFlyoutPresenter class is not a ContentPresenter derived class, it's actually a control (derived from ItemsControl ) that plays a special role when creating the visual tree for a MenuFlyout.

Control style and template

You can modify the default Style and ControlTemplate to give the control a unique appearance. For information about modifying a control's style and template, see Styling controls. The default style, template, and resources that define the look of the control are included in the generic.xaml file. For design purposes, generic.xaml is available in the (Program Files)\Windows Kits\10\DesignTime\CommonConfiguration\Neutral\UAP&lt;SDK version>\Generic folder from a Windows Software Development Kit (SDK) installation. Styles and resources from different versions of the SDK might have different values.

Starting in Windows 10, version 1607 (Windows Software Development Kit (SDK) version 10.0.14393.0), generic.xaml includes resources that you can use to modify the colors of a control in different visual states without modifying the control template. In apps that target this software development kit (SDK) or later, modifying these resources is preferred to setting properties such as Background and Foreground. For more info, see the Light-weight styling section of the Styling controls article.

This table shows the resources used by the MenuFlyoutPresenter control.

Resource keyDescription
MenuFlyoutPresenterBackgroundBackground color of entire control bounds
MenuFlyoutPresenterBorderBrushBorder color of entire control bounds

Constructors

MenuFlyoutPresenter() MenuFlyoutPresenter() MenuFlyoutPresenter()

Initializes a new instance of the MenuFlyoutPresenter class.

public MenuFlyoutPresenter()public MenuFlyoutPresenter()Public Sub New()
Attributes

Properties

TemplateSettings TemplateSettings TemplateSettings

Gets an object that provides calculated values that can be referenced as TemplateBinding sources when defining templates for a MenuFlyoutPresenter control.

public MenuFlyoutPresenterTemplateSettings TemplateSettings { get; }public MenuFlyoutPresenterTemplateSettings TemplateSettings { get; }Public ReadOnly Property TemplateSettings As MenuFlyoutPresenterTemplateSettings
Attributes

See Also