Skip to content

Instantly share code, notes, and snippets.

@rtanote
Created May 15, 2013 12:26
Show Gist options
  • Save rtanote/5583640 to your computer and use it in GitHub Desktop.
Save rtanote/5583640 to your computer and use it in GitHub Desktop.
xamlでボタンのクリックイベントを実装する場合のいくつかのパターン。
<!-- without Interaction Trigger -->
<Button Content="Hoge"
Command="{Binding DoCommand}"
CommandParameter="hoge"
/>
<!-- Interaction Trigger with InvkeoCommandAction -->
<Button Content="Hoge" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<i:InvokeCommandAction Command="{Binding DoCommand}" CommandParameter="hoge" />
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
<!-- Interaction Trigger with LivetCallMethodAction -->
<Button Content="Hoge" >
<i:Interaction.Triggers>
<i:EventTrigger EventName="Click">
<l:LivetCallMethodAction MethodTarget="{Binding}" MethodName="Do" MethodParameter="hoge"/>
</i:EventTrigger>
</i:Interaction.Triggers>
</Button>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment