WPF选项卡控件拖放:将选项卡置于前面的行为 [英] WPF tab control drag 'n drop: bring tab in front behavior

查看:159
本文介绍了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;
    }
}

这篇关于WPF选项卡控件拖放:将选项卡置于前面的行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆