public TreeListViewRowDoubleClickHandler(RadTreeListView treeListView) { MouseButtonEventHandler handler = (sender, args) => { var row = sender as TreeListViewRow; if (row != null) { var methodName = GetMethodName(treeListView); var dataContextType = treeListView.DataContext.GetType(); var method = dataContextType.GetMethod(methodName); if (method == null) { throw new MissingMethodException(methodName); } method.Invoke(treeListView.DataContext, null); } }; treeListView.RowLoaded += (s, e) => { e.Row.MouseDoubleClick += handler; }; treeListView.RowUnloaded += (s, e) => { e.Row.MouseDoubleClick -= handler; }; }
private static void ExpandAndScrollRecursive(RadTreeListView treeListView, object item, IList<object> itemsToExpand) { treeListView.ScrollIntoViewAsync(item, (f) => { treeListView.ExpandHierarchyItem(item); itemsToExpand.Remove(item); ExpandAndScrollRecursive(treeListView, itemsToExpand.FirstOrDefault(), itemsToExpand); }); }
public static void SetMethodName(RadTreeListView treeListView, string value) { treeListView.SetValue(MethodNameProperty, value); }
public static string GetMethodName(RadTreeListView treeListView) { return (string)treeListView.GetValue(MethodNameProperty); }
public static TreeViewDragDropBehavior GetAttachedBehavior(RadTreeListView gridview) { if (!instances.ContainsKey(gridview)) { instances[gridview] = new TreeViewDragDropBehavior(); instances[gridview].AssociatedObject = gridview; } return instances[gridview]; }