how can i find flyoutmenu item from FlyoutBase.AttachedFlyout


  • Hello,

    I have created a custom control in which i have attachedflyout like below

                <local:BinFeatureButton  FlyoutBase.AttachedFlyout="{StaticResource BinTypeMenu}" x:Name="BinMakeFeatureControl" Background="Black" Tapped="BinFeatureButton_Tapped_1" HorizontalAlignment="Left" ButtonKey="BinMake" ButtonCaption="{Binding BinMake}"  Margin="5,0,0,0"  VerticalAlignment="Top" ButtonImage="&#xf1b2;">

    when i tap on this control it shows flyout menu as expected like below.

    private void BinFeatureButton_Tapped_1(object sender, TappedRoutedEventArgs e)
                FlyoutBase.ShowAttachedFlyout(sender as FrameworkElement); 

    that also works fine.

    but my question is how can i change background color of particular menuflyoutItem

    This should happen as soon as i tap on control before/after showAttachFlyout method fires.

    Hoping for best.


    Thursday, November 20, 2014 4:45 AM


  • I think that you would use

    FlyoutBase MyFlyout = FlyoutBase.GetAttachedFlyout(sender as FrameworkElement);
    // Do stuff with MyFlyout, like change its color
    FlyoutBase.ShowAttachedFlyout(sender as FrameworkElement);

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, November 20, 2014 1:03 PM