Can't create flyout in Windows Phone 8.1 Silverlight app

616 Views Asked by At

Adding a flyout seemed like a pretty straightforward task, but I can't seem to even initialize one on my app (which is based on a PivotControl app template for Windows Phone 8.1 Silverlight). When I attempt to do this:

    <phone:PhoneApplicationPage.Resources>
         <Flyout x:Key="MyFlyout"></Flyout>
    </phone:PhoneApplicationPage.Resources>

I immediately get a blue squiggly line below Flyout saying "The name Flyout doesn't exist in the namespace http://schemas.microsoft.com/clients/2007". What gives?

1

There are 1 best solutions below

2
On

<Flyout> is only available in Windows Phone 8.1 runtime (Silverlight is a no-go). See the MSDN Reference FlyOut.

If you want something similar to a <Flyout> that would work for Silverlight, download and install the Windows Phone Toolkit -- NuGet or get it here : The Windows Phone Toolkit

Using the <toolkit:ContextMenuService.ContextMenu>

<container_ui>
    <toolkit:ContextMenuService.ContextMenu>    
        <toolkit:ContextMenu>   
            <toolkit:MenuItem Header="menu_1" Click="Click_Event"/>
            <toolkit:MenuItem Header="menu_2" Command="{Binding CommandBinding}"/>    
        </toolkit:ContextMenu>    
    </toolkit:ContextMenuService.ContextMenu>
</container_ui>