using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; using System.Windows.Controls; using System.Windows.Markup; namespace Tango.DragAndDrop { [ContentProperty(nameof(InnerContent))] public class DragAndDropContainer : ContentControl { public DragAndDropContainer() { Grid g = new Grid(); Content = g; ContentControl control = new ContentControl(); control.Bind(ContentControl.ContentProperty, this, InnerContentProperty, System.Windows.Data.BindingMode.OneWay); g.Children.Add(control); DraggingSurface = new DraggingSurface(); g.Children.Add(DraggingSurface); } public DraggingSurface DraggingSurface { get { return (DraggingSurface)GetValue(DraggingSurfaceProperty); } private set { SetValue(DraggingSurfaceProperty, value); } } public static readonly DependencyProperty DraggingSurfaceProperty = DependencyProperty.Register("DraggingSurface", typeof(DraggingSurface), typeof(DragAndDropContainer), new PropertyMetadata(null)); public Object InnerContent { get { return (Object)GetValue(InnerContentProperty); } set { SetValue(InnerContentProperty, value); } } public static readonly DependencyProperty InnerContentProperty = DependencyProperty.Register("InnerContent", typeof(Object), typeof(DragAndDropContainer), new PropertyMetadata(null)); } }