internal void AddToListView(DataTreeListView listView) { this.isInListView = true; if (base.Index < 0 && listView != null) { int num; if (this.Parent == null) { num = listView.Items.Count; } else { int num2 = this.Parent.ChildrenItems.IndexOf(this); if (num2 == 0) { num = this.Parent.Index + 1; } else if (this.Parent.ChildrenItems[num2 - 1].Index > 0) { num = this.Parent.ChildrenItems[num2 - 1].GetNextSiblingListViewIndex(); } else { num = -1; } } if (num >= 0) { listView.Items.Insert(num, this); } } this.BindToChildDataSources(); this.RecreateChildItems(); listView.RestoreItemStates(this); }
private void DrawPlusMinusButtons() { using (Graphics graphics = base.CreateGraphics()) { foreach (object obj in base.Items) { DataTreeListViewItem dataTreeListViewItem = (DataTreeListViewItem)obj; Rectangle bounds = dataTreeListViewItem.Bounds; if (bounds.Bottom >= base.ClientRectangle.Top) { bounds.Width = base.Columns[0].Width; bounds.Intersect(base.ClientRectangle); if (!dataTreeListViewItem.IsLeaf && !bounds.IsEmpty && dataTreeListViewItem.ChildrenItems.Count > 0) { Region clip = graphics.Clip; graphics.SetClip(LayoutHelper.MirrorRectangle(bounds, this)); DataTreeListView.DrawPlusMinusButton(graphics, LayoutHelper.MirrorRectangle(dataTreeListViewItem.GetPlusMinusButtonBound(), this), !dataTreeListViewItem.IsExpanded); graphics.Clip = clip; } else if (bounds.Top > base.ClientRectangle.Bottom) { break; } } } } }
public DataTreeListViewItemCollection(DataTreeListView listView) { if (listView == null) { throw new NotSupportedException(); } this.listView = listView; }
private void InitializeExportListCommands() { if (this.exportListCommandSeparator == null) { this.exportListCommandSeparator = Command.CreateSeparator(); } if (this.exportListCommand == null) { this.exportListCommand = new Command(); this.exportListCommand.Text = Strings.ExportListDefaultCommandText; this.exportListCommand.Icon = Icons.ExportList; this.exportListCommand.Name = "ExportListCommand"; this.exportListCommand.Execute += this.ExportListCommand_Execute; } base.ExportListCommands.AddRange(new Command[] { this.exportListCommandSeparator, this.exportListCommand }); if (this.ListControl is DataTreeListView) { if (this.expandAllCommand == null) { this.expandAllCommand = new Command(); this.expandAllCommand.Text = Strings.ExpandAllDefaultCommandText; this.expandAllCommand.Name = "ExpandAllCommand"; this.expandAllCommand.Icon = Icons.ExpandAll; this.expandAllCommand.Execute += delegate(object param0, EventArgs param1) { DataTreeListView dataTreeListView = this.ListControl as DataTreeListView; if (dataTreeListView != null) { dataTreeListView.ExpandAll(); } }; } base.ExportListCommands.Insert(base.ExportListCommands.IndexOf(this.exportListCommand), this.expandAllCommand); if (this.collapseRootsCommand == null) { this.collapseRootsCommand = new Command(); this.collapseRootsCommand.Text = Strings.CollapseAllDefaultCommandText; this.collapseRootsCommand.Name = "CollapseAllCommand"; this.collapseRootsCommand.Icon = Icons.CollapseAll; this.collapseRootsCommand.Execute += delegate(object param0, EventArgs param1) { DataTreeListView dataTreeListView = this.ListControl as DataTreeListView; if (dataTreeListView != null) { dataTreeListView.CollapseRootItems(); } }; } base.ExportListCommands.Insert(base.ExportListCommands.IndexOf(this.exportListCommand), this.collapseRootsCommand); } }
public DataTreeListViewItem(DataTreeListView listView, object row, DataTreeListViewItem parentItem) { this.dataSource = row; this.listView = listView; this.IsLeaf = true; this.Parent = parentItem; if (this.Parent != null) { this.Parent.ChildrenItems.Add(this); } }
public DataTreeListViewItem(DataTreeListView listView, object row) : this(listView, row, null) { }