/// <summary> /// When IWindowService is invalidated, it means that this control is either placed into /// a window's visual tree or taken out. If we are in a new Window's visual tree, we /// want to set the reference to this object inside the Window. Window uses this /// reference in its WM_NCHITTEST code /// </summary> private void OnWindowServiceChanged(Window oldWindow, Window newWindow) { if ((oldWindow != null) && (oldWindow != newWindow)) { oldWindow.ClearResizeGripControl(this); } if (newWindow != null) { newWindow.SetResizeGripControl(this); } }