protected override void CheckItems(System.Collections.IList newItems) { foreach (object newItem in newItems) { if (!(newItem is DocumentContent)) { throw new InvalidOperationException("FloatingDocumentPane can contain only DocumentContents!"); } } if (Items.Count == 0 && FloatingWindow != null) { FloatingWindow.Close(true); } }
public void StartDrag(FloatingWindow wnd, Point point, Point offset) { Debug.Assert(!IsDragging); IsDragging = true; Offset = offset; _wnd = wnd; if (Offset.X >= _wnd.Width) { Offset.X = _wnd.Width / 2; } _wnd.Left = point.X - Offset.X; _wnd.Top = point.Y - Offset.Y; _wnd.Show(); int surfaceCount = 0; restart: surfaceCount = Surfaces.Count; foreach (IDropSurface surface in Surfaces) { if (surface.SurfaceRectangle.Contains(point)) { SurfacesWithDragOver.Add(surface); surface.OnDragEnter(point); Debug.WriteLine("Enter " + surface.ToString()); if (surfaceCount != Surfaces.Count) { //Surfaces list has been changed restart cycle SurfacesWithDragOver.Clear(); goto restart; } } } }