Skip to content

Instantly share code, notes, and snippets.

@pinzolo
Created June 19, 2012 05:39
Show Gist options
  • Save pinzolo/2952468 to your computer and use it in GitHub Desktop.
Save pinzolo/2952468 to your computer and use it in GitHub Desktop.
HierarchicalDataTemplate な TreeViewItem にイベントを設定する
<Window x:Class="MktSys.Gui.HierarchicalDataTemplateTreeViewItemEventSettingWindos"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="HierarchicalDataTemplate な TreeViewItem にイベントを設定する" Height="525" Width="300">
<Grid>
<TreeView Name="treeView" ItemsSource="{Binding Elements}" VerticalContentAlignment="Stretch">
<TreeView.ItemContainerStyle>
<Style TargetType="{x:Type TreeViewItem}">
<EventSetter Event="MouseDoubleClick" Handler="treeViewItem_MouseDoubleClick" />
</Style>
</TreeView.ItemContainerStyle>
<TreeView.ItemTemplate>
<HierarchicalDataTemplate ItemsSource="{Binding Children}">
<Label Content="{Binding Name}" />
</HierarchicalDataTemplate>
</TreeView.ItemTemplate>
</TreeView>
</Grid>
</Windows>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment