예제 #1
0
        private static CanvasDragDropBehavior GetAttachedBehavior(Canvas canvas)
        {
            if (!instances.ContainsKey(canvas))
            {
                instances[canvas] = new CanvasDragDropBehavior();
                instances[canvas].AssociatedObject = canvas;
            }

            return(instances[canvas]);
        }
예제 #2
0
		private static CanvasDragDropBehavior GetAttachedBehavior(Canvas canvas)
		{
			if (!instances.ContainsKey(canvas))
			{
				instances[canvas] = new CanvasDragDropBehavior();
				instances[canvas].AssociatedObject = canvas;
			}

			return instances[canvas];
		}
예제 #3
0
        public static void SetIsEnabled(DependencyObject obj, bool value)
        {
            CanvasDragDropBehavior behavior = GetAttachedBehavior(obj as Canvas);

            behavior.AssociatedObject = obj as Canvas;

            if (value)
            {
                behavior.Initialize();
            }
            else
            {
                behavior.CleanUp();
            }
            obj.SetValue(IsEnabledProperty, value);
        }