Thanks a lot for the answer. yes that works.
Your answer made me think of another workaround that allowed me to use the MenuFlyout and access the flyout using the click event for the MenuFlyoutItem. Also, since I like the fact that the MenuFlyout get hidden after the click.
This is what I did:
- Created a button with my Flyout.
<Button x:Name="clickme" Click="clickme_Click" Content="click me"> <FlyoutBase.AttachedFlyout> <Flyout Placement="Full"> <StackPanel Background="Red"> <TextBlock Text="text" /> <Button Content="Yes" /> </StackPanel> </Flyout> </FlyoutBase.AttachedFlyout> </Button>
- added the click event behind Code
private void clickme_Click(object sender, RoutedEventArgs e) { FlyoutBase.ShowAttachedFlyout((FrameworkElement)sender); }
- In the MenuFlyoutItem I added the Click event as shown in my example.
In that click event I Triggered the button click through code in the code behindprivate void MenuFlyoutItem_Click(object sender, RoutedEventArgs e) { clickme_Click(clickme, e); }
And 4. I Hidden the button lol
I'm new, so still experimenting with this. If you see any issue with this workaround let me know.
Thanks again :)