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 8629513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:49:36+00:00 2026-06-12T08:49:36+00:00

I have a tabcontrol with tab items. I would like to open a specific

  • 0

I have a tabcontrol with tab items. I would like to open a specific tab in its own window when an user “tears” it off the tab control. I know what to do in terms of creating the window and moving the tab item into that window.

But, I can’t seem to figure out how to keep the window under the mouse, after creating, when it is torn off; so the user interaction is seamless.

I have this in the tabitem’s code:

 protected override void OnPreviewMouseMove(MouseEventArgs e)
        {
            base.OnPreviewMouseMove(e);
            if(e.LeftButton == MouseButtonState.Pressed && _startPoint != null)
            {
                Point position = e.GetPosition(null);

                if (Math.Abs(position.Y - _startPoint.Value.Y) > SystemParameters.MinimumVerticalDragDistance)
                {
                    Point cursor = Utils.GetCursorPosition();
                    var w = new AttachableWindow(){WindowStartupLocation = WindowStartupLocation.Manual, Left = cursor.X, Top=cursor.Y};
                    w.Show();
                    _startPoint = null;
                    e.Handled = true;
                }
            }
        }
  • 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-06-12T08:49:38+00:00Added an answer on June 12, 2026 at 8:49 am

    Use DragMove method to get the window to move:

    w.Loaded += (sender, args) =>
                            {
                                (sender as Window).DragMove();
                            };
    

    Edit: Be careful that doing this in the loaded event can cause the window to render partially. I think the activated event is a better choice.

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

Sidebar

Related Questions

I would like to extend the tab control to have closeable tab items. I
I have a WPF Menu and a Tab control. I would like the list
I have MainWindow and 2 user controls. In Main Window there is Tab Control
I have 3 tab items to implement. When the program executes, I would like
I have a tab control created by CreateWindowEx(NULL, WC_TABCONTROL,...) . I would like to
I would like to have a button that switches a tab control to a
I have a WPF tab control. but I would like to change the tab
I have a tab control with two different potential item templates: <TabControl ItemTemplateSelector={StaticResource tabTemplateSelector}/>
I have several forms added to the pages of the tab control via tabcontrol.tabpages.controls.add
In my application I have a tab control which has several tab items. The

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.