我需要打开一个菜单,因为WP7 not designed要执行这样的操作,我正在使用Toolkit.以下是示例代码:
<Border BorderThickness="3" Padding="6">
<toolkit:ContextMenuService.ContextMenu>
<toolkit:ContextMenu>
<toolkit:MenuItem Header="item1" Click="Item1_Click" />
<toolkit:MenuItem Header="item2" Click="Item2_Click" />
<toolkit:MenuItem Header="item3" Click="Item3_Click" />
</toolkit:ContextMenu>
</toolkit:ContextMenuService.ContextMenu>
<TextBlock Text="Tap" />
</Border>
Run Code Online (Sandbox Code Playgroud)
现在只要用户按下并保持动作,这就可以正常工作.但我不能要求用户采取这样的行动.我需要在单击/点击/触摸/手势(您要调用它的水)上显示菜单.有人可以建议吗?如果您认为工具包不是最佳方式,那么请使用示例代码建议替代方案.我试过弹出窗口,但这比我的应用程序更糟糕
我有一个简单的代码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using System.IO;
public partial class WebClient : PhoneApplicationPage
{
public WebClient()
{
InitializeComponent();
}
private void button1_Click(object sender, RoutedEventArgs e)
{
WebClient webclient = new WebClient();
Run Code Online (Sandbox Code Playgroud)
现在,当我说webClient.,我希望在IntelliSense下拉列表中看到DownloadStringCompleted,但我没看到.当我强制使用它时,当然它不会编译.问题是什么?
我正在测试WebClient以查看它是否在我的项目中使用,因为我厌倦了异步调用和与HttpWebRequest相关联的多个线程