你应该能够做这样的事情
用户控件.xaml
<TreeView SelectedItemChanged="TreeViewHandler" />
用户控件.cs
public delegate void TreeViewSelectedItemHandler(object sender, RoutedPropertyChangedEventArgs<object> e);
public event TreeViewSelectedItemHandler TreeViewSelectedItemChanged;
private void TreeViewHandler(object sender, RoutedPropertyChangedEventArgs<object> e)
{
//Capture event from usercontrol and execute defined event
if (TreeViewSelectedItemChanged != null)
{
TreeViewSelectedItemChanged(sender, e);
}
}
窗口.xaml
<local:myUsercontrol TreeViewSelectedItemChanged="myHandler" />
窗口.cs
private void myHandler(object sender, RoutedPropertyChangedEventArgs<object> e)
{
//Do stuff
}