Hi.
I am using Lesters DragAndDropManager to get the drag and drop function in my application and i really like the way it's implemented, but I have one small problem and that is that I want to show the mouse cordination during the drag in my statusbar, so how do I send the mouseposition from the DropManager to my xaml code.
I have tried to add a dependencyproperty in the manager that I can bind to in the xaml-code.
public static readonly DependencyProperty MousePointProperty =
DependencyProperty.RegisterAttached("MousePoint", typeof(Point), typeof(DragDropBehavior),
new FrameworkPropertyMetadata(default(Point)));
public static void SetMousePoint(DependencyObject depObj, bool isSet)
{
depObj.SetValue(MousePointProperty, isSet);
}
public static IDragSourceAdvisor GetMousePoint(DependencyObject depObj)
{
return depObj.GetValue(MousePointProperty) as IDragSourceAdvisor;
}
And in the Xaml I bind to it like this.
<StatusBar>
<TextBlock Text="{Binding local:DragDropBehavior.MousePoint.X}"/>
</StatusBar>
But how do I set the mousecordintation to my dependecyproperty in the manager?
private static void DropTarget_PreviewDragOver(object sender, DragEventArgs e)
{
if (UpdateEffects(sender, e) == false) return;
//-- Update position of the preview Adorner
Point position = GetMousePosition(sender as UIElement);
//-- Here I Want to do this, but that not posible because the SetMousePoint takes a dependencyObject and not my value.
//-- SetMousePoint(position);
_draggedUIElementAdorner.Left = position.X - _offsetPoint.X;
_draggedUIElementAdorner.Top = position.Y - _offsetPoint.Y;
e.Handled = true;
}
I think I am wrong here, but I have get stuck on how to get the mousecordination to the xaml-code by binding to the DragAndDropManager.
Thanks.