protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); if (e.LeftButton != MouseButtonState.Pressed) this.dragStartPoint = null; if (this.dragStartPoint.HasValue) { // XamlWriter.Save() has limitations in exactly what is serialized, // see SDK documentation; short term solution only; string xamlString = XamlWriter.Save(this.Content); DragObject dataObject = new DragObject(); dataObject.Xaml = xamlString; Grid grid = this.Content as Grid; if (grid != null) { RowDefinition row1 = grid.RowDefinitions[0]; RowDefinition row2 = grid.RowDefinitions[1]; double height = row1.ActualHeight + row2.ActualHeight; this.Height = height; dataObject.DesiredSize = new Size(this.ActualWidth, this.Height); } else { dataObject.DesiredSize = new Size(this.ActualWidth, this.ActualHeight); } DragDrop.DoDragDrop(this, dataObject, DragDropEffects.Copy); e.Handled = true; } }