or
We currently have a DevCraft license and thought it'd be best not to reinvent the wheel in this rather little pet project, and there's no resource at the moment here who currenlty have any background to WPF. So any thoughts would be highly appreciated! Thanks!
private void OnDragQueryHandler(object sender, DragDropQueryEventArgs e){ if (e.Options.Status == DragStatus.DragQuery) { RadTreeViewItem item = e.OriginalSource as RadTreeViewItem; ContentControl cue = new ContentControl(); cue.ContentTemplate = this.Resources["ApplicationDragTemplate"] as DataTemplate; cue.Content = new TextBlock() { Padding = new Thickness(5), Background = new SolidColorBrush(Colors.LightBlue), FontSize = 12 }; if (item.Item is CustomItem) { // do stuff } else { e.QueryResult = false; return; } e.Options.DragCue = cue; } e.QueryResult = true;}private void OnDragInfoHandler(object sender, DragDropEventArgs e){ if (e.Options.Status == DragStatus.DragComplete) { // do stuff }}
And drop code:
private void OnDropQueryHandler(object sender, DragDropQueryEventArgs e)
{
var payload = e.Options.Payload;
e.QueryResult = payload is CustomItem;
}
private void OnDropInfoHandler(object sender, DragDropEventArgs e)
{
if (e.Options.Status == DragStatus.DropPossible)
{
UI_RadChart.BorderBrush = WPConstants.DRAG_BRUSH;
}
else
{
UI_RadChart.BorderBrush = null;
}
if (e.Options.Status == DragStatus.DropComplete)
{
// DO STUFF, NOT REACHING HERE
}
}
var cmd = default(RoutedUICommand);switch (newVal){ case Go.Previous: { cmd = RadGridViewCommands.MoveUp as RoutedUICommand; } break; case Go.Next: { cmd = RadGridViewCommands.MoveDown as RoutedUICommand; } break;}if (cmd != null && cmd.CanExecute(null, gridView)){ cmd.Execute(null, gridView); var selectCmd = RadGridViewCommands.SelectCurrentUnit as RoutedUICommand; if (selectCmd != null && selectCmd.CanExecute(null, gridView)) { selectCmd.Execute(null, gridView); }}