模版样式为:<DataTemplate >
<StackPanel >
<Button/>
</StackPanel >
</DataTemplate >
使用datatemplate的TreeViewItem,根据内部的Button获取tvi
TreeViewItem tvi = ((ContentPresenter)(((StackPanel)((Button)sender).Parent).TemplatedParent)).TemplatedParent as TreeViewItem;