Hi Telerik,
I am using the code from your example Tree To Grid Drag.
The problem is the I have no space between the arrow and the dragged visual but running your demo directly from your website there is a space between the mouse arrow and dragged border.
why is the same code not working for me please?
My data template for the dragged data object is
It seems to me, that data template has nothing to do with it.
http://www.telerik.com/help/silverlight/dragdrompmanager-howto-set-drag-visual.html
In this example, the mouse arrow is in the centre of dragged border. How can I achieve this?
Thank you very much.
I am using the code from your example Tree To Grid Drag.
e.DragVisualOffset = e.RelativeStartPoint
private
void
OnDragInitialize(
object
sender, DragInitializeEventArgs e)
{
DropIndicationDetails details =
new
DropIndicationDetails();
var listBoxItem = e.OriginalSource
as
System.Windows.Controls.ListBoxItem ?? (e.OriginalSource
as
FrameworkElement).ParentOfType<System.Windows.Controls.ListBoxItem>();
var item = listBoxItem !=
null
? listBoxItem.DataContext : (sender
as
System.Windows.Controls.ListBox).SelectedItem;
details.CurrentDraggedItem = item;
IDragPayload dragPayload = DragDropPayloadManager.GeneratePayload(
null
);
dragPayload.SetData(
"DraggedData"
, item);
dragPayload.SetData(
"DropDetails"
, details);
e.Data = dragPayload;
e.DragVisual =
new
DragVisual()
{
Content = details,
ContentTemplate = Application.Current.Resources[
"sboDragged"
]
as
DataTemplate
};
e.DragVisualOffset = e.RelativeStartPoint;
//new Point(e.RelativeStartPoint.X+10 , e.DragVisualOffset.Y +10);
e.AllowedEffects = DragDropEffects.All;
}
The problem is the I have no space between the arrow and the dragged visual but running your demo directly from your website there is a space between the mouse arrow and dragged border.
why is the same code not working for me please?
My data template for the dragged data object is
<
DataTemplate
x:Key
=
"sboDragged"
>
<
Grid
>
<
Grid.RowDefinitions
>
<
RowDefinition
Height
=
"auto"
/>
<
RowDefinition
Height
=
"auto"
/>
<
RowDefinition
Height
=
"auto"
/>
</
Grid.RowDefinitions
>
<
Grid.ColumnDefinitions
>
<
ColumnDefinition
Width
=
"auto"
/>
<
ColumnDefinition
Width
=
"auto"
/>
</
Grid.ColumnDefinitions
>
<
TextBlock
Text
=
"Dragged ... Name:"
/>
<
TextBlock
Text
=
"{Binding CurrentDraggedItem.Name}"
Grid.Column
=
"1"
/>
<
TextBlock
Text
=
"Id:"
Grid.Row
=
"1"
/>
<
TextBlock
Grid.Row
=
"1"
Text
=
"{Binding CurrentDraggedItem.Id}"
Grid.Column
=
"1"
/>
<
StackPanel
Orientation
=
"Horizontal"
Grid.Row
=
"2"
Grid.ColumnSpan
=
"2"
>
<
TextBlock
Text
=
"{Binding CurrentDropPosition}"
FontWeight
=
"Bold"
MinWidth
=
"45"
/>
<
TextBlock
Text
=
", ("
Foreground
=
"Gray"
/>
<
TextBlock
Text
=
"{Binding CurrentDraggedOverItem.Name}"
/>
<
TextBlock
Text
=
")"
Foreground
=
"Gray"
/>
</
StackPanel
>
</
Grid
>
</
DataTemplate
>
It seems to me, that data template has nothing to do with it.
http://www.telerik.com/help/silverlight/dragdrompmanager-howto-set-drag-visual.html
In this example, the mouse arrow is in the centre of dragged border. How can I achieve this?
Thank you very much.