Wednesday, February 15, 2012

Draggable Window in WPF

In my WPF application, the opacity of the window has been set to transparent and the ResizeMode has been set to No Resize. This application has a user control as child element.

When the window is renedered on screen, i can't drag the object/window in my screen. So to do this, you have to check the mouse down event in your windows. Then call the DragMove method.

Here is the snippet:
Code:
void Window_MouseDown(object sender, MouseButtonEventArgs e)  
{  
   if (e.LeftButton == MouseButtonState.Pressed)  
      this.DragMove();  
} 

2 comments: