实际上,我试图在Xaml文件的ViewModel中提供的UpdateWord(object obj)方法中传递单词文档的名称。这样它将打开word文档。
<Button Content="Show Word" Width="100" Height="25" Margin="128,70,22,37">
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<si:CallDataMethod Method="UpdateWord"/>
<si:SetProperty TargetName="LayoutRoot"
PropertyName="Background" Value="PaleGoldenrod"/>
</i:EventTrigger>
</i:Interaction.Triggers>
ViewModel:
public void UpdateWord(Object obj)
{
//Do Something ..... ;
}
最佳答案
你可以这样
<i:EventTrigger EventName="Click">
<cmd:EventToCommand Command="{Binding UpdateWord}"
PassEventArgsToCommand="True" />
</i:EventTrigger>
您可以参考此帖子以获取更多详细信息:http://weblogs.asp.net/alexeyzakharov/silverlight-commands-hacks-passing-eventargs-as-commandparameter-to-delegatecommand-triggered-by-eventtrigger