WPF选项卡控件拖放:将选项卡置于前面的行为

问题描述:

我想用tab控件实现拖放操作,即将项目拖到标签条上将其放在最前面。
哪一种是最有效且最不干扰的方式?

I would like to implement drag 'n drop with a tabcontrol in a way that dragging an item to tag strip brings it to front. Which is the most efficient and non obtrusive way?

谢谢

private void TabControl_DragEnter(object sender, DragEventArgs e)
{
    TabItem item = e.Source as TabItem;
    TabControl tabControl = sender as TabControl;
    if (item != null && tabControl != null)
    {
        if (tabControl.SelectedItem != item)
            tabControl.SelectedItem = item;
    }
}