blob: 043613308d6381713fd044bed2cda9986c2759b4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
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));
}
}
|