Hi
I have a draggable treeview and I would like to write on dragvisual content something like "Drop inside <Node Information>".
How can I get the Node information?
I tried something like this but "options" is always null
Thanks
I have a draggable treeview and I would like to write on dragvisual content something like "Drop inside <Node Information>".
How can I get the Node information?
I tried something like this but "options" is always null
private Telerik.Windows.Controls.Label dragVisualLabel;
private void OnDragInitialize(object sender, DragInitializeEventArgs args)
{
this.dragVisualLabel = new Telerik.Windows.Controls.Label() { ContentTemplate = RootGrid.Resources["ItemTemplate"] as DataTemplate, Content = "" };
args.DragVisual = this.dragVisualLabel;
}
private void OnGiveFeedback(object sender, Telerik.Windows.DragDrop.GiveFeedbackEventArgs args)
{
if (args.Effects == DragDropEffects.Move)
{
args.UseDefaultCursors = false;
args.SetCursor(Cursors.Hand);
var options = DragDropPayloadManager.GetDataFromObject(args.OriginalSource, TreeViewDragDropOptions.Key) as TreeViewDragDropOptions;
if (options != null)
{
var dragVisual = options.DragVisual as TreeViewDragVisual;
if (dragVisual != null)
{
var classModel = (options.DropTargetItem).DataContext as ClassObjectModel;
if (classModel != null)
{
this.dragVisualLabel.Content = string.Format("Drop inside {0} - {1}", classModel.Class.Code, classModel.Class.Description);
}
}
}
// this.dragVisualLabel.Background = new SolidColorBrush(Colors.Yellow);
}
else if (args.Effects == DragDropEffects.None)
{
args.UseDefaultCursors = false;
args.SetCursor(Cursors.None);
// this.dragVisualLabel.Background = new SolidColorBrush(Colors.Red);
}
else
{
args.UseDefaultCursors = true;
// this.dragVisualLabel.Background = new SolidColorBrush(Colors.Green);
}
args.Handled = true;
}
Thanks