Ejemplo n.º 1
0
        static void EnableMultiSelectChanged(DependencyObject s, DependencyPropertyChangedEventArgs args)
        {
            TreeListView tree      = (TreeListView)s;
            var          wasEnable = (bool)args.OldValue;
            var          isEnabled = (bool)args.NewValue;

            if (wasEnable)
            {
                tree.RemoveHandler(TreeViewItem.MouseDownEvent, new MouseButtonEventHandler(ItemClicked));
                tree.RemoveHandler(TreeViewItem.MouseDoubleClickEvent, new MouseButtonEventHandler(MouseDoubleClick));
                tree.RemoveHandler(TreeView.KeyDownEvent, new KeyEventHandler(KeyDown));
                tree.RemoveHandler(TreeView.KeyUpEvent, new KeyEventHandler(KeyUp));
            }
            if (isEnabled)
            {
                SelectedTreeItems = new List <object>();
                tree.AddHandler(TreeViewItem.MouseDownEvent, new MouseButtonEventHandler(ItemClicked), true);
                tree.AddHandler(TreeViewItem.MouseDoubleClickEvent, new MouseButtonEventHandler(MouseDoubleClick), true);
                tree.AddHandler(TreeView.KeyDownEvent, new KeyEventHandler(KeyDown));
                tree.AddHandler(TreeView.KeyUpEvent, new KeyEventHandler(KeyUp));
            }
        }
Ejemplo n.º 2
0
 private static void UpdateAnchorAndActionItem(TreeListView tree, TreeListViewItem item)
 {
     SetAnchorItem(tree, item);
 }
Ejemplo n.º 3
0
 private static void MakeToggleSelection(TreeListView tree, TreeListViewItem item)
 {
     SetIsSelected(item, !GetIsSelected(item));
     UpdateAnchorAndActionItem(tree, item);
 }
Ejemplo n.º 4
0
 public static List <TreeListViewItem> GetSelectedTreeViewItems(TreeListView tree)
 {
     return(GetExpandedTreeViewItems(tree).Where(i => GetIsSelected(i)).ToList());
 }