public static List<ColumnData> GetColumnData(TreeViewAdv treeViewAdv)
        {
            Dictionary<int, ColumnData> columns = new Dictionary<int, ColumnData>();
            foreach (TreeColumn col in treeViewAdv.Columns)
            {
                NamedTreeColumn column = col as NamedTreeColumn;
                if (column == null)
                    continue;

                columns.Add(column.Index, new ColumnData()
                {
                    Name = column.Name,
                    Header = column.Header,
                    SortOrder = column.SortOrder,
                    TooltipText = column.TooltipText,
                    Width = column.Width
                });
            }

            foreach (NodeControl nodeControl in treeViewAdv.NodeControls)
            {
                ColumnData column = columns[nodeControl.ParentColumn.Index];
                var columnItem = new ColumnItemData();
                if (nodeControl.GetType() == typeof(NodeCheckBox))
                    columnItem.Type = ColumnItemType.NodeCheckBox;
                else if (nodeControl.GetType() == typeof(NodeIcon))
                    columnItem.Type = ColumnItemType.NodeIcon;
                else if (nodeControl.GetType() == typeof(NodeTextBox))
                    columnItem.Type = ColumnItemType.NodeTextBox;

                switch (columnItem.Type)
                {
                    case ColumnItemType.NodeCheckBox:
                        columnItem.DataPropertyName = ((NodeCheckBox)nodeControl).DataPropertyName;
                        columnItem.EditEnabled = ((NodeCheckBox)nodeControl).EditEnabled;
                        columnItem.LeftMargin = ((NodeCheckBox)nodeControl).LeftMargin;
                        break;

                    case ColumnItemType.NodeIcon:
                        columnItem.DataPropertyName = ((NodeIcon)nodeControl).DataPropertyName;
                        columnItem.LeftMargin = ((NodeIcon)nodeControl).LeftMargin;
                        columnItem.ImageScaleMode = ((NodeIcon)nodeControl).ScaleMode;
                        break;

                    case ColumnItemType.NodeTextBox:
                        columnItem.DataPropertyName = ((NodeTextBox)nodeControl).DataPropertyName;
                        columnItem.IncrementalSearchEnabled = ((NodeTextBox)nodeControl).IncrementalSearchEnabled;
                        columnItem.LeftMargin = ((NodeTextBox)nodeControl).LeftMargin;
                        break;
                }

                column.Items.Add(columnItem);
            }

            return columns.Values.ToList();
        }
        public static List<ColumnData> GetColumnData(XmlDocument doc)
        {
            var columns = new List<ColumnData>();
            XmlNodeList colWidths = doc.GetElementsByTagName(Constants.TREEVIEWADVCOLUMNSINFO);
            if (colWidths.Count >= 1)
            {
                foreach (XmlNode columnNode in colWidths[0].ChildNodes)
                {
                    ColumnData columnData = new ColumnData();
                    foreach (XmlAttribute att in columnNode.Attributes)
                    {
                        if (att.Name == Constants.NAME && !string.IsNullOrEmpty(att.Value))
                            columnData.Header = att.Value;
                        else if (att.Name == Constants.SORTORDER && !string.IsNullOrEmpty(att.Value))
                            columnData.SortOrder = (SortOrder)int.Parse(att.Value);
                        else if (att.Name == Constants.TOOLTIPTEXT && !string.IsNullOrEmpty(att.Value))
                            columnData.TooltipText = att.Value;
                        else if (att.Name == Constants.WIDTH && !string.IsNullOrEmpty(att.Value))
                            columnData.Width = int.Parse(att.Value);
                    }

                    foreach (XmlNode columnItemNode in columnNode.ChildNodes)
                    {
                        ColumnItemData columnItem = new ColumnItemData();
                        foreach (XmlAttribute att in columnItemNode.Attributes)
                        {
                            if (att.Name == Constants.TYPE && !string.IsNullOrEmpty(att.Value))
                                columnItem.Type = (ColumnItemType)int.Parse(att.Value);
                            else if (att.Name == Constants.DATAPROPERTYNAME && !string.IsNullOrEmpty(att.Value))
                                columnItem.DataPropertyName = (att.Value == "SiteHandlerName") ? "SiteHandlerNameUI" : att.Value;
                            else if (att.Name == Constants.EDITENABLED && !string.IsNullOrEmpty(att.Value))
                                columnItem.EditEnabled = att.Value.Equals(Constants.TRUE, StringComparison.CurrentCultureIgnoreCase);
                            else if (att.Name == Constants.INCREMENTALSEARCHENABLED && !string.IsNullOrEmpty(att.Value))
                                columnItem.IncrementalSearchEnabled = att.Value.Equals(Constants.TRUE, StringComparison.CurrentCultureIgnoreCase);
                            else if (att.Name == Constants.LEFTMARGIN && !string.IsNullOrEmpty(att.Value))
                                columnItem.LeftMargin = int.Parse(att.Value);
                            else if (att.Name == Constants.SCALEMODE && !string.IsNullOrEmpty(att.Value))
                                columnItem.ImageScaleMode = (ImageScaleMode)int.Parse(att.Value);
                        }

                        columnData.Items.Add(columnItem);
                    }

                    columns.Add(columnData);
                }
            }

            return columns;
        }
        public static List <ColumnData> GetColumnData(XmlDocument doc)
        {
            var         columns   = new List <ColumnData>();
            XmlNodeList colWidths = doc.GetElementsByTagName(Constants.TREEVIEWADVCOLUMNSINFO);

            if (colWidths.Count >= 1)
            {
                foreach (XmlNode columnNode in colWidths[0].ChildNodes)
                {
                    ColumnData columnData = new ColumnData();
                    foreach (XmlAttribute att in columnNode.Attributes)
                    {
                        if (att.Name == Constants.NAME && !string.IsNullOrEmpty(att.Value))
                        {
                            columnData.Header = att.Value;
                        }
                        else if (att.Name == Constants.SORTORDER && !string.IsNullOrEmpty(att.Value))
                        {
                            columnData.SortOrder = (SortOrder)int.Parse(att.Value);
                        }
                        else if (att.Name == Constants.TOOLTIPTEXT && !string.IsNullOrEmpty(att.Value))
                        {
                            columnData.TooltipText = att.Value;
                        }
                        else if (att.Name == Constants.WIDTH && !string.IsNullOrEmpty(att.Value))
                        {
                            columnData.Width = int.Parse(att.Value);
                        }
                    }

                    foreach (XmlNode columnItemNode in columnNode.ChildNodes)
                    {
                        ColumnItemData columnItem = new ColumnItemData();
                        foreach (XmlAttribute att in columnItemNode.Attributes)
                        {
                            if (att.Name == Constants.TYPE && !string.IsNullOrEmpty(att.Value))
                            {
                                columnItem.Type = (ColumnItemType)int.Parse(att.Value);
                            }
                            else if (att.Name == Constants.DATAPROPERTYNAME && !string.IsNullOrEmpty(att.Value))
                            {
                                columnItem.DataPropertyName = (att.Value == "SiteHandlerName") ? "SiteHandlerNameUI" : att.Value;
                            }
                            else if (att.Name == Constants.EDITENABLED && !string.IsNullOrEmpty(att.Value))
                            {
                                columnItem.EditEnabled = att.Value.Equals(Constants.TRUE, StringComparison.CurrentCultureIgnoreCase);
                            }
                            else if (att.Name == Constants.INCREMENTALSEARCHENABLED && !string.IsNullOrEmpty(att.Value))
                            {
                                columnItem.IncrementalSearchEnabled = att.Value.Equals(Constants.TRUE, StringComparison.CurrentCultureIgnoreCase);
                            }
                            else if (att.Name == Constants.LEFTMARGIN && !string.IsNullOrEmpty(att.Value))
                            {
                                columnItem.LeftMargin = int.Parse(att.Value);
                            }
                            else if (att.Name == Constants.SCALEMODE && !string.IsNullOrEmpty(att.Value))
                            {
                                columnItem.ImageScaleMode = (ImageScaleMode)int.Parse(att.Value);
                            }
                        }

                        columnData.Items.Add(columnItem);
                    }

                    columns.Add(columnData);
                }
            }

            return(columns);
        }
        public static List <ColumnData> GetColumnData(TreeViewAdv treeViewAdv)
        {
            Dictionary <int, ColumnData> columns = new Dictionary <int, ColumnData>();

            foreach (TreeColumn col in treeViewAdv.Columns)
            {
                NamedTreeColumn column = col as NamedTreeColumn;
                if (column == null)
                {
                    continue;
                }

                columns.Add(column.Index, new ColumnData()
                {
                    Name        = column.Name,
                    Header      = column.Header,
                    SortOrder   = column.SortOrder,
                    TooltipText = column.TooltipText,
                    Width       = column.Width
                });
            }

            foreach (NodeControl nodeControl in treeViewAdv.NodeControls)
            {
                ColumnData column     = columns[nodeControl.ParentColumn.Index];
                var        columnItem = new ColumnItemData();
                if (nodeControl.GetType() == typeof(NodeCheckBox))
                {
                    columnItem.Type = ColumnItemType.NodeCheckBox;
                }
                else if (nodeControl.GetType() == typeof(NodeIcon))
                {
                    columnItem.Type = ColumnItemType.NodeIcon;
                }
                else if (nodeControl.GetType() == typeof(NodeTextBox))
                {
                    columnItem.Type = ColumnItemType.NodeTextBox;
                }

                switch (columnItem.Type)
                {
                case ColumnItemType.NodeCheckBox:
                    columnItem.DataPropertyName = ((NodeCheckBox)nodeControl).DataPropertyName;
                    columnItem.EditEnabled      = ((NodeCheckBox)nodeControl).EditEnabled;
                    columnItem.LeftMargin       = ((NodeCheckBox)nodeControl).LeftMargin;
                    break;

                case ColumnItemType.NodeIcon:
                    columnItem.DataPropertyName = ((NodeIcon)nodeControl).DataPropertyName;
                    columnItem.LeftMargin       = ((NodeIcon)nodeControl).LeftMargin;
                    columnItem.ImageScaleMode   = ((NodeIcon)nodeControl).ScaleMode;
                    break;

                case ColumnItemType.NodeTextBox:
                    columnItem.DataPropertyName         = ((NodeTextBox)nodeControl).DataPropertyName;
                    columnItem.IncrementalSearchEnabled = ((NodeTextBox)nodeControl).IncrementalSearchEnabled;
                    columnItem.LeftMargin = ((NodeTextBox)nodeControl).LeftMargin;
                    break;
                }

                column.Items.Add(columnItem);
            }

            return(columns.Values.ToList());
        }