Make a window draggable within a certain boundary WPF
问题 I have a wpf child window that I allow dragging by using the DragMove() method. However, I need to allow the window to be dragged only within the bounds of its Parent window control. Can anyone suggest a way to achieve this? Thanks! 回答1: There are two ways to do this. Using LocationEnded If you handle this event you can change the Top or Left to be within the bounds of the owner window. e.g. private void Window_LocationChanged(object sender, EventArgs e) { if (this.Left < this.Owner.Left)