You should do this by creating a bool varaiable (call it canDrag) as a form level variable and explicitly creating a MouseLeftButtonDown event which will only drag if canDrag = true. Something like this:-
bool canDrag = false;
public MainWindow()
{
InitializeComponent();
MouseLeftButtonDown +=new System.Windows.Input.MouseButtonEventHandler(MainWindow_MouseLeftButtonDown);
}
void MainWindow_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (canDrag)
{
this.DragMove();
}
}
You can then set canDrag to true and false in the appropriate places. I used buttons to test like this:-
private void btnDrag_Click(object sender, RoutedEventArgs e)
{
canDrag = true;
}
private void btnNoDrag_Click(object sender, RoutedEventArgs e)
{
canDrag = false ;
}
Hope this helps