locked
Please help! I'm having some problems with borderless windows in wpf. RRS feed

  • Question

  • Here's What I Did:

    1. Checked "AllowsTransparency" for the window
    2. Drew a rectangle for the body
    3. Added 3 buttons: Photobucket (They do the correct functions)
    4. Made a window: Photobucket (Blue)
    5. The blue part was a recangle. I highlighted it, and then selected Tools > Make Button (It's named "drag")

    I opened C# to edit the function for the button and tried many different ways to get this to work, including this.DragMove;

    Can anyone tell me how to move the window by dragging the blue part? (As if you were dragging the title bar on a normal form)

    Sunday, March 29, 2009 7:34 PM

All replies

  • Hi Thingula,
    What event do you have associated with your button's event handler? Click?

    Cheers!
    Kirupa (MS)
    Sunday, March 29, 2009 8:27 PM
    Moderator
  • I tried this.DragMove;
    Sunday, March 29, 2009 8:29 PM
  • You need to create an event handler for MouseLeftButtonDown for this element and in that event handler call DragMove();
    If you also what the title to be double-clickable to maximize/restore the window, add the following code to this handler:

    if (e.ClickCount == 2)
    {
         this.WindowState = this.WindowState == WindowState.Normal ? WindowState.Maximized : WindowState.Normal;
    }

    The double click is not the cleanest solution, but it's the best I could come up with when I did this same exact thing recently.

    Brent
    Wednesday, April 8, 2009 1:33 PM