I have this code that shows a MenuFlyout on certain position of the app (where the user has RightTapped on the control). Tap events on the items are risen Ok when I place the MenuFlyout with
f.ShowAt(sender as FrameworkElement)
but it's position is not near where it must be shown (the sender control is quite big in the screen).
So, I changed the showing command to
f.ShowAt(sender as FrameworkElement, args.Position).
Now, the MenuFlyout is shown where it should be (just on top of the RightTap position), but it doesn't react to tap events on the items. MenuFlyout hides but there's no event on items.
MenuFlyout f = new MenuFlyout();
MenuFlyoutItem menuFlyoutItem = new MenuFlyoutItem
{
Text = "Open in X1",
IsTabStop = false,
Tag = args.Location
};
menuFlyoutItem.AddHandler(TappedEvent, new TappedEventHandler(OpenInX1_Tapped), true);
f.Items.Add(menuFlyoutItem);
menuFlyoutItem = new MenuFlyoutItem
{
Text = "Open in X2",
IsTabStop = false,
Tag = args.Location
};
menuFlyoutItem.AddHandler(TappedEvent, new TappedEventHandler(OpenInX2_Tapped), true);
f.Items.Add(menuFlyoutItem);
f.Placement = FlyoutPlacementMode.Top;
f.ShowAt(sender as FrameworkElement, args.Position);
//f.ShowAt(sender as FrameworkElement);
Do you why is this happening? And, how could I fix it?
Thank you.