CaptureMouse prevents moving RadWindow

2 posts, 0 answers
  1. Cameron Molyneux
    Cameron Molyneux avatar
    79 posts
    Member since:
    Jan 2010

    Posted 05 Mar 2012 Link to this post

    Hi there,

    I have been experimenting with having windows maximise when you drag them to the top, like in Windows 7.

    However, using this.CaptureMouse(); in the RadWindow stops the window from being able to be moved.

    private void RadWindow_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        vertPosition = e.GetPosition(null).Y;
        isCaptured = true;
    private void RadWindow_MouseMove(object sender, MouseEventArgs e)
        if (isCaptured)
            vertPosition = e.GetPosition(null).Y;
            this.Top = e.GetPosition(null).Y;
            this.Left = e.GetPosition(null).X;
    private void RadWindow_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        if (isCaptured)
            if (vertPosition < 30.0)
            this.Height = App.Current.Host.Content.ActualHeight;
            this.Width = App.Current.Host.Content.ActualWidth;
        isCaptured = false;
    As you can see from the code I tried to handle moving the window myself, however this causes the resize arrow to appear even if I drag from the header or inside the Window.

    Is this a bug or is there a correct way to use CaptureMouse?

  2. Konstantina
    Konstantina avatar
    2332 posts

    Posted 08 Mar 2012 Link to this post

    Hi Cameron,

    All this is caused because we are registering to these event and handling them. I am afraid there is no way this can be achieved with the current implementation of the control.
    The only idea I can give you (although this is not tested and I am not sure if you are not going to hit a stumbling block along the way) is to track the position of the mouse and when it reaches the specified position to check whether the RadWindow is dragged with its IsDragging property and maximize it.

    Hope this information helps.

    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top