private static TreeItemDropBehavior GetAttachedBehavior(RadTreeViewItem treeViewItem) { if (!Instances.ContainsKey(treeViewItem)) { Instances[treeViewItem] = new TreeItemDropBehavior { AssociatedObject = treeViewItem }; } return(Instances[treeViewItem]); }
public static void SetIsEnabled(DependencyObject obj, bool value) { var treeViewItem = obj.ParentOfType <RadTreeViewItem>(); TreeItemDropBehavior behavior = GetAttachedBehavior(treeViewItem); behavior.AssociatedObject = treeViewItem; if (value) { behavior.Initialize(); } else { behavior.CleanUp(); } obj.SetValue(IsEnabledProperty, value); }