Esempio n. 1
0
        public bool Regroup()
        {
            try{
                ListViewAPI.ClearListViewGroup(this);
                foreach (XPListViewGroup grp in this.Groups)
                {
                    ListViewAPI.AddListViewGroup(this, grp.GroupText, grp.GroupIndex);
                }

                foreach (XPListViewItem itm in this.Items)
                {
                    ListViewAPI.AddItemToGroup(this, itm.Index, itm.GroupIndex);
                }

                int param = 0;
                ListViewAPI.SendMessage(this.Handle, ListViewAPI.LVM_ENABLEGROUPVIEW, 1, ref param);
                _showInGroups = true;
                _autoGroup    = false;
                _autoGroupCol = null;
                _autoGroupList.Clear();

                return(true);
            }
            catch (Exception ex) {
                throw new SystemException("Error in XPListView.Regroup: " + ex.Message);
            }
        }
Esempio n. 2
0
 public int Add(XPListViewGroup value)
 {
     ListViewAPI.AddListViewGroup(_owner, value.GroupText, value.GroupIndex);
     if (GroupAdded != null)
     {
         GroupAdded(this, new ListViewGroupEventArgs(value));
     }
     return(List.Add(value));
 }
Esempio n. 3
0
        public int Add(string text, int index)
        {
            XPListViewGroup itm = new XPListViewGroup(text, index);

            ListViewAPI.AddListViewGroup(_owner, text, index);
            if (GroupAdded != null)
            {
                GroupAdded(this, new ListViewGroupEventArgs(itm));
            }
            return(List.Add(itm));
        }
Esempio n. 4
0
        private void _items_ItemAdded(object sender, ListViewItemEventArgs e)
        {
            string text;

            if (_autoGroup)
            {
                text = e.Item.SubItems[_autoGroupCol.Index].Text;
                if (!_autoGroupList.Contains(text))
                {
                    _autoGroupList.Add(text);
                    ListViewAPI.AddListViewGroup(this, text, _autoGroupList.IndexOf(text));
                }
                ListViewAPI.AddItemToGroup(this, e.Item.Index, _autoGroupList.IndexOf(text));
            }
        }
Esempio n. 5
0
        public bool AutoGroupByColumn(int columnID)
        {
            if (columnID >= this.Columns.Count || columnID < 0)
            {
                return(false);
            }

            try{
                _autoGroupList.Clear();
                foreach (XPListViewItem itm in this.Items)
                {
                    if (!_autoGroupList.Contains(itm.SubItems[columnID].Text == "" ? _emptyAutoGroupText : itm.SubItems[columnID].Text))
                    {
                        _autoGroupList.Add(itm.SubItems[columnID].Text == "" ? EmptyAutoGroupText : itm.SubItems[columnID].Text);
                    }
                }

                _autoGroupList.Sort();

                ListViewAPI.ClearListViewGroup(this);
                foreach (string text in _autoGroupList)
                {
                    ListViewAPI.AddListViewGroup(this, text, _autoGroupList.IndexOf(text));
                }

                foreach (XPListViewItem itm in this.Items)
                {
                    ListViewAPI.AddItemToGroup(this, itm.Index, _autoGroupList.IndexOf(itm.SubItems[columnID].Text == "" ? _emptyAutoGroupText : itm.SubItems[columnID].Text));
                }

                int param = 0;
                ListViewAPI.SendMessage(this.Handle, ListViewAPI.LVM_ENABLEGROUPVIEW, 1, ref param);
                _showInGroups = true;
                _autoGroup    = true;
                _autoGroupCol = this.Columns[columnID];

                this.Refresh();

                return(true);
            }
            catch (Exception ex) {
                throw new SystemException("Error in XPListView.AutoGroupByColumn: " + ex.Message);
            }
        }