分配点击到网格

MTA*_*MTA 3 c# silverlight windows-phone-7

我尝试添加我的网格点击处理程序:

<Grid x:Name="LayoutRoot" Background="#FF1F1F1F" Tap="OnTap">........</Grid>
Run Code Online (Sandbox Code Playgroud)

InitializeComponent();我得到这个:

A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in System.Windows.ni.dll

Failed to assign to property 'System.Windows.UIElement.Tap'. [Line: 14 Position: 58]

    {System.Windows.Markup.XamlParseException: Failed to assign to property 'System.Windows.UIElement.Tap'. [Line: 14 Position: 58]
   at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
   at *.NowPlayingPageControl.InitializeComponent()
   at *.NowPlayingPageControl..ctor()}
Run Code Online (Sandbox Code Playgroud)

Deb*_*ere 7

我有同样的问题,我在XAMl页面中做了什么,其中抛出了XamlParseException我检查了所有tap事件,在其中一个Tap事件处理程序中我发现它没有导航到后面的代码.

休息没关系.所以我检查后面的代码,发现引用.dll时存在歧义.

GestureEventsArgs 在以下参考文献中有歧义.

System.Windows.Input.GestureEventArgsMicrosoft.Phone.Controls.GestureEventArgs

所以我换成Microsoft.Phone.Controls.GestureEventArgsSystem.Windows.Input.GestureEventArgs

现在它的工作正常.我想要指出的一件事是在我安装Toolkit dll之后发生这种情况,否则我的代码在此之前工作正常.正如@haxor已经指出的那样.