Class MouseDragElementBehavior
Repositions the attached element in response to mouse drag gestures on the element.
public class MouseDragElementBehavior : Behavior<FrameworkElement>, IAttachedObject
- Inheritance
-
Behavior<FrameworkElement>MouseDragElementBehavior
- Implements
- Inherited Members
Constructors
MouseDragElementBehavior()
public MouseDragElementBehavior()
Fields
ConstrainToParentBoundsProperty
Dependency property for the ConstrainToParentBounds property. If true, the dragged element will be constrained to stay within the bounds of its parent container.
public static readonly DependencyProperty ConstrainToParentBoundsProperty
Field Value
- DependencyProperty
XProperty
Dependency property for the X position of the dragged element, relative to the left of the root element.
public static readonly DependencyProperty XProperty
Field Value
- DependencyProperty
YProperty
Dependency property for the Y position of the dragged element, relative to the top of the root element.
public static readonly DependencyProperty YProperty
Field Value
- DependencyProperty
Properties
ConstrainToParentBounds
Gets or sets a value indicating whether the dragged element is constrained to stay within the bounds of its parent container. This is a dependency property.
public bool ConstrainToParentBounds { get; set; }
Property Value
- bool
True
if the dragged element should be constrained to its parents bounds; otherwise,False
.
X
Gets or sets the X position of the dragged element, relative to the left of the root element. This is a dependency property.
public double X { get; set; }
Property Value
Y
Gets or sets the Y position of the dragged element, relative to the top of the root element. This is a dependency property.
public double Y { get; set; }
Property Value
Methods
OnAttached()
Called after the behavior is attached to an AssociatedObject.
protected override void OnAttached()
Remarks
Override this to hook up functionality to the AssociatedObject.
OnDetaching()
Called when the behavior is getting detached from its AssociatedObject, but before it has actually occurred.
protected override void OnDetaching()
Remarks
Override this to unhook functionality from the AssociatedObject.
Events
DragBegun
Occurs when a drag gesture is initiated.
public event MouseEventHandler DragBegun
Event Type
- MouseEventHandler
DragFinished
Occurs when a drag gesture is finished.
public event MouseEventHandler DragFinished
Event Type
- MouseEventHandler
Dragging
Occurs when a drag gesture update is processed.
public event MouseEventHandler Dragging
Event Type
- MouseEventHandler