Skip to content

Instantly share code, notes, and snippets.

@rtanote
Created June 14, 2013 15:54
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rtanote/5782973 to your computer and use it in GitHub Desktop.
Save rtanote/5782973 to your computer and use it in GitHub Desktop.
Livetを使ったListViewのRoutedEvent処理(ListViewItemのダブルクリックを捕捉してActionを起動する)
// ↓ コードビハインド
<ListView>
<ListView.View>
<!-- リスト -->
</ListView.View>
<ListView.ItemContainerStyle>
<Style TargetType="{x:Type ListViewItem}">
<EventSetter Event="MouseDoubleClick" Handler="ListViewItem_MouseDoubleClick"/>
</Style>
</ListView.ItemContainerStyle>
</ListView>
// ↓ LivetのRoutedEventTriggerを使って任意のアクションを実行
<!--
xmlns:l="http://schemas.livet-mvvm.net/2011/wpf"
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
-->
<ListView>
<ListView.View>
<!-- リスト -->
</ListView.View>
<i:Interaction.Triggers>
<l:RoutedEventTrigger RoutedEvent="ListViewItem.MouseDoubleClick">
<!-- action -->
</l:RoutedEventTrigger>
</i:Interaction.Triggers>
</ListView>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment