Ejemplo n.º 1
0
 protected virtual void OnItemRemoved(TreeListViewEventArgs e)
 {
     if (ItemRemoved != null)
     {
         ItemRemoved(this, e);
     }
 }
Ejemplo n.º 2
0
        internal void CollapseInternal()
        {
            if (IsInATreeListView && ListView.InvokeRequired)
            {
                throw new Exception("Invoke Required");
            }
            TreeListViewItem treeListViewItem = null;

            if (TreeListView != null)
            {
                treeListViewItem = TreeListView.FocusedItem;
            }
            if (Visible && _IsExpanded && ListView != null)
            {
                TreeListViewCancelEventArgs treeListViewCancelEventArgs = new TreeListViewCancelEventArgs(this, TreeListViewAction.Collapse);
                ListView.RaiseBeforeCollapse(treeListViewCancelEventArgs);
                if (treeListViewCancelEventArgs.Cancel)
                {
                    return;
                }
            }
            if (Visible)
            {
                foreach (TreeListViewItem item in Items)
                {
                    item.Hide();
                }
            }
            if (Visible && _IsExpanded && IsInATreeListView)
            {
                _IsExpanded = false;
                TreeListViewEventArgs e = new TreeListViewEventArgs(this, TreeListViewAction.Collapse);
                ListView.RaiseAfterCollapse(e);
                if (this.AfterCollapse != null)
                {
                    this.AfterCollapse(this);
                }
            }
            _IsExpanded = false;
            if (IsInATreeListView && treeListViewItem != null)
            {
                if (treeListViewItem.Visible)
                {
                    treeListViewItem.Focused = true;
                }
                else
                {
                    ListView treeListView = TreeListView;
                    treeListView.SelectedItems.Clear();
                    TreeListViewItem[] parentsInHierarch = treeListViewItem.ParentsInHierarch;
                    int num = parentsInHierarch.Length - 1;
                    while (true)
                    {
                        if (num < 0)
                        {
                            return;
                        }
                        if (parentsInHierarch[num].Visible)
                        {
                            break;
                        }
                        num--;
                    }
                    parentsInHierarch[num].Focused = true;
                }
            }
        }
Ejemplo n.º 3
0
        internal void ExpandInternal()
        {
            if (IsInATreeListView && ListView.InvokeRequired)
            {
                throw new Exception("Invoke Required");
            }
            TreeListViewItem treeListViewItem = null;

            if (TreeListView != null)
            {
                treeListViewItem = TreeListView.FocusedItem;
            }
            CheckDirection checkDirection = CheckDirection.All;

            if (ListView != null)
            {
                checkDirection          = ListView.CheckDirection;
                ListView.CheckDirection = CheckDirection.None;
            }
            if (Visible && !_IsExpanded && ListView != null)
            {
                TreeListViewCancelEventArgs treeListViewCancelEventArgs = new TreeListViewCancelEventArgs(this, TreeListViewAction.Expand);
                ListView.RaiseBeforeExpand(treeListViewCancelEventArgs);
                if (treeListViewCancelEventArgs.Cancel)
                {
                    return;
                }
            }
            if (Visible)
            {
                for (int num = Items.Count - 1; num >= 0; num--)
                {
                    TreeListViewItem treeListViewItem2 = Items[num];
                    if (!treeListViewItem2.Visible)
                    {
                        ListView treeListView = TreeListView;
                        treeListView.Items.Insert(base.Index + 1, treeListViewItem2);
                        treeListViewItem2.SetIndentation();
                    }
                    if (treeListViewItem2.IsExpanded)
                    {
                        treeListViewItem2.Expand();
                    }
                }
            }
            if (Visible && !_IsExpanded && IsInATreeListView)
            {
                _IsExpanded = true;
                TreeListViewEventArgs e = new TreeListViewEventArgs(this, TreeListViewAction.Expand);
                ListView.RaiseAfterExpand(e);
                if (this.AfterExpand != null)
                {
                    this.AfterExpand(this);
                }
            }
            _IsExpanded = true;
            if (IsInATreeListView)
            {
                ListView.CheckDirection = checkDirection;
            }
            if (TreeListView != null && treeListViewItem != null && treeListViewItem.Visible)
            {
                treeListViewItem.Focused = true;
            }
        }