积极答复者
如何手动为控件添加Command命令

问题
-
需要把WIN8中的GridView控件的ItemClickg事件绑定Command命令,不知道怎么做?
在WP开发中,可以使用下面的代码为控件添加Command(使用MVVMLight)
- xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Extras.WP8"
- p; xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
- <Button Content="Button" HorizontalAlignment="Left" Margin="97,238,0,0" VerticalAlignment="Top" RenderTransformOrigin="0.373,0.357">
- <i:Interaction.Triggers>
- <i:EventTrigger EventName="MouseMove">
- <cmd:EventToCommand Command="{Binding MouseMoveCommand}"></cmd:EventToCommand>
- </i:EventTrigger>
- </i:Interaction.Triggers>
- </Button>
但在win8没有找到Interaction.Triggers,应该如何做呢?
答案
-
HI edmundzhang
Windows Store App的Command和SliverLight的Command有一点不一样。
以下链接给你参考下: http://stackoverflow.com/questions/1852084/mvvm-command-binding
希望能帮到你。
James He
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- 已标记为答案 Jamles HezModerator 2013年6月20日 1:53
全部回复
-
HI edmundzhang
Windows Store App的Command和SliverLight的Command有一点不一样。
以下链接给你参考下: http://stackoverflow.com/questions/1852084/mvvm-command-binding
希望能帮到你。
James He
MSDN Community Support | Feedback to us
Develop and promote your apps in Windows Store
Please remember to mark the replies as answers if they help and unmark them if they provide no help.- 已标记为答案 Jamles HezModerator 2013年6月20日 1:53