我有一个 ListView 中定义的项目列表。当用户单击或点击任何项目时,我想在所选项目上方显示一个 PopupMenu。我应该如何定位 PopupMenu?
varmenu =newPopupMenu();
menu.Commands.Add(
newUICommand("Remove", (x) =>
{...
// Create the message dialog and set its content
}, 1));
var chosenCommand =awaitmenu.ShowForSelectionAsync(GetElementRect((FrameworkElement)sender));
Rect GetElementRect(FrameworkElement element)
{
GeneralTransform buttonTransform = element.TransformToVisual(null);
Pointpoint = buttonTransform.TransformPoint(newPoint());
returnnewRect(point,newSize(element.ActualWidth, element.ActualHeight));
}