带 EventToCommand 的图钉
我正在尝试调整Windows Phone 7 TrainingKit 中包含的UsingBingMaps 示例(http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=ca23285f-bab8-47fa-b364-11553e076a9a) 到使用 MVVM-Light 工具包。我正在尝试使用 EventToCommand 设置图钉的 MouseLeftButtonUp 事件的命令,但该命令未执行。下面是图钉的代码:
<my:Pushpin Style="{StaticResource PushpinStyle}"
Location="{Binding Location}"
Background="{Binding TypeName, Converter={StaticResource PushpinTypeBrushConverter}}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<cmd:EventToCommand Command="{Binding DataContext.PushpinClickCommand, ElementName=HomePage}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<Image Source="{Binding Icon}" />
</my:Pushpin>
我错过了什么吗?有人能够将 EventToCommand 与 Pushpin 对象一起使用吗?
I am trying to adapt the UsingBingMaps sample included in the Windows Phone 7 TrainingKit (http://www.microsoft.com/downloads/en/details.aspx?displaylang=en&FamilyID=ca23285f-bab8-47fa-b364-11553e076a9a) to use MVVM-Light toolkit. I am trying to set up a command to the Pushpin's MouseLeftButtonUp event using EventToCommand but the command does not get executed. Below is the code of the pushpin:
<my:Pushpin Style="{StaticResource PushpinStyle}"
Location="{Binding Location}"
Background="{Binding TypeName, Converter={StaticResource PushpinTypeBrushConverter}}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MouseLeftButtonUp">
<cmd:EventToCommand Command="{Binding DataContext.PushpinClickCommand, ElementName=HomePage}"/>
</i:EventTrigger>
</i:Interaction.Triggers>
<Image Source="{Binding Icon}" />
</my:Pushpin>
Am I missing anything? Was anyone able to use EventToCommand with the Pushpin object?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您想用该命令做什么?
我可以使用它来获取触发命令,但我似乎无法从传递的参数中获取对象详细信息。
我已经在 silverlight 中使用了它,我认为它可以直接在 WP7 中使用(如果我错了,请纠正我)
在我的 viewmodel 构造函数中,我
在 viewmodel 类中
希望这会有所帮助。如果您弄清楚如何传递对象详细信息,请发回,因为我在这篇文章中遇到问题< /a>
What are you trying to do with the command?
I can get a command to fire using this, but i cant seem to get the object details from the arguments passed.
I have used this in silverlight, which I think is directly usable in WP7 (please correct me if I am mistaken)
In my viewmodel constructor I have
in viewmodel class
Hope this helps out. If you work out how to pass the object details, please post back as I have problem on this post