Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6818057
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:07:47+00:00 2026-05-26T21:07:47+00:00

I have a tab control which allows me to drag the tab items out

  • 0

I have a tab control which allows me to drag the tab items out of my application.
This dragging will open a new window which will follow the mouse until I release the left mouse button.
Also it is possible to drag the tab item back into the source tab control and reattach it to its former parent or to any other control capable of understanding the dragged data.

private static void DragOutTabControl_PreviewQueryContinueDrag(object sender, QueryContinueDragEventArgs e)
{
   e.Handled = true;

   if (DragControlIsHit)
   {
      if (_previewWindow != null && _previewWindow.IsVisible)
      {
         _previewWindow.Clear();
         _previewWindow.Hide();
      }
   }
   else
   {
      if (_previewWindow == null)
      {
         _previewWindow = new PreviewWindow();
         _previewWindow.SetData();
      }

      _previewWindow.Left = CursorPos.X - 15;
      _previewWindow.Top = CursorPos.Y - 15;
      _previewWindow.Show();
   }
}

The problem I am having now is that when the preview window is following the mouse it is positioned directly under the cursor.
This way the dragEnter and dragOver events of the source tab control are not firing since the window is blocking the hit testing.
Even if I set IsHitTestVisible to false in the window the hit test will be blocked while the drag&drop is still active.
Setting IsEnabled to false and changing the background to null does not have any effect.

public PreviewWindow()
{
   Background = null;
   IsEnabled = false;
   IsHitTestVisible = false;
}

Is there any possibility to hide the preview window from any hit tests or to pass the hit test manually to any control visually behind the dragged window?

Edit, some more information to my problem:
I don’t only want to drag tab items out of my tab control and open new windows for them, but also I want to be able to drag additional tab items into existing drag-out-windows.
Additionally dragging a tab item back into the original tab control should be possible.

All of this is working quite well except for the only problem that I can’t hide the preview window from drag&drop-hittesting.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T21:07:48+00:00Added an answer on May 26, 2026 at 9:07 pm

    I had a similar question about DragDrop event hit testing, and the answer I received was to switch to using MouseEvents instead of DragDrop events. I made the switch and never regretted it, nor have I ever tried going back to WPF’s built-in DragDrop events.

    As an alternative if you don’t want to use use Mouse Events, would be to show your window on the Adorner Layer instead of the UI layer, and only render it as a new object once the Drop event occurs.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application I have a tab control which has several tab items. The
I have 2 tab items. In tab No.1 I have a control which corresponds
I am writing an application in which I utilize a tab control which will
I have a form which has only tab control in it. I want to
I have a tab control with two tabs. Both tabs have controls which are
I have a tab-based application for windows, which I am developing by myself. I
I have a custom tab control, which displays a frame inside the TabItem, and
I have a .NET forms application using a tab control with several tabs. There
Hi I have a tab control which is bound to a collection property of
My application's main component is a tab control which holds N number of views

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.