English 中文(简体)
A. 开幕背景
原标题:Opening context menu just above item in win 8 metro app
  • 时间:2012-04-23 09:05:25
  •  标签:
  • windows-8

我在一份清单中列出了清单。 当用户点击或操纵任何项目时,我希望在选定的项目之上显示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));
}
问题回答

这是I ve正在使用的一种手法,在一只 app子上打开一个波纹身。

private async void OnOpenMenu(object sender, RoutedEventArgs e)
{
    var button = (Button)sender;
    var transform = button.TransformToVisual(this);
    var point = transform.TransformPoint(new Point(0, 0));

    var menu = new PopupMenu();

    menu.Commands.Add(new UICommand("Menu Item 1"));
    menu.Commands.Add(new UICommand("Menu Item 2"));

    await menu.ShowAsync(point);
}




相关问题
Will WPF be relevant with Windows 8? [closed]

With windows 8 demonstrating native HTML 5 apps . The first thing that I think of is whether WPF has a place in this HTML 5 world. It kind of seems like Silverlight will stick around but I must ask ...

Metro styled Silverlight Applications

Is there any guidance available on developing Metro styled silverlight applications? How does one go about designing the UI to match the metro look and feel of WP7. Going by the way windows 8 s UI &...

Best Alternative for Converting VB6 to run under Windows 8

I originally (many years ago) wrote my applications using VB6 on the assumption that it was a strategic Microsoft product and so I would be able to run them as long as I wanted. However with Windows 8 ...

VB6 Running on Windows 8?

Assuming that vb6 does not run on Windows 8 because the VB6 run time libraries are not shipped with Windows 8, would it not be possible to install the VB6 run time library on Windows 8 and then then ...

How to load any XAP file with the Windows Phone 7 emulator

Does anyone know if it is possible to load a windows phone 7 XAP file into the emulator without the solution or source files? In other words, can I send somebody just a XAP file so that they can test ...

热门标签