Esempio n. 1
0
 public void Reset()
 {
     this.item       = null;
     this.group      = null;
     this.index      = -1;
     this.groupIndex = -1;
 }
Esempio n. 2
0
        protected virtual bool MovePreviousFromGroupItem(PropertyGridGroupItem currentGroup)
        {
            if (this.groupIndex > 0)
            {
                PropertyGridGroupItem prevGroup = ((PropertyGridGroup)(object)propertyGridElement.CollectionView.Groups[--this.groupIndex]).GroupItem;
                if (prevGroup.Expanded)
                {
                    this.index = prevGroup.GridItems.Count - 1;
                    this.item  = this.GetLastChild(prevGroup.GridItems[this.index]);
                    return(true);
                }

                this.group = prevGroup;
                this.item  = this.group;
                this.index = -1;
                return(true);
            }
            else if (this.groupIndex == 0)
            {
                this.Reset();
                return(true);
            }

            return(false);
        }
Esempio n. 3
0
 public PropertyGridTraverserState(
     PropertyGridGroupItem group,
     PropertyGridItemBase item,
     int index,
     int groupIndex)
 {
     this.group      = group;
     this.item       = item;
     this.index      = index;
     this.groupIndex = groupIndex;
 }
Esempio n. 4
0
        public System.Collections.IEnumerator GetEnumerator()
        {
            if (enumerator == null)
            {
                this.enumerator = new PropertyGridTraverser(this.propertyGridElement);
            }

            this.enumerator.item       = this.item;
            this.enumerator.group      = this.group;
            this.enumerator.index      = this.index;
            this.enumerator.groupIndex = this.groupIndex;

            return(enumerator);
        }
Esempio n. 5
0
        protected virtual bool MoveNextFromGroupItem(PropertyGridGroupItem currentGroup)
        {
            if (currentGroup.Expanded && currentGroup.GridItems.Count > 0)
            {
                this.item  = currentGroup.GridItems[0];
                this.index = 0;
                return(true);
            }

            if (groupIndex + 1 < this.propertyGridElement.CollectionView.Groups.Count)
            {
                this.group = ((PropertyGridGroup)(object)propertyGridElement.CollectionView.Groups[++this.groupIndex]).GroupItem;
                this.item  = this.group;
                return(true);
            }

            return(false);
        }
Esempio n. 6
0
        protected virtual bool MoveNextCore()
        {
            if (this.item == null)
            {
                return(MoveToFirst());
            }

            if (this.item is PropertyGridGroupItem)
            {
                PropertyGridGroupItem group = this.item as PropertyGridGroupItem;
                return(MoveNextFromGroupItem(group));
            }
            else
            {
                PropertyGridItem currentItem = this.item as PropertyGridItem;
                return(MoveNextFromDataItem(currentItem, true, false));
            }
        }
Esempio n. 7
0
        protected virtual bool MovePreviousCore()
        {
            if (this.item == null)
            {
                return(false);
            }

            if (this.item is PropertyGridGroupItem)
            {
                PropertyGridGroupItem group = this.item as PropertyGridGroupItem;
                return(MovePreviousFromGroupItem(group));
            }
            else
            {
                PropertyGridItem currentItem = this.item as PropertyGridItem;
                return(MovePreviousFromDataItem(currentItem));
            }
        }
Esempio n. 8
0
        public bool MoveToFirst()
        {
            if (this.propertyGridElement.CollectionView.Groups.Count > 0)
            {
                this.group      = ((PropertyGridGroup)propertyGridElement.CollectionView.Groups[0]).GroupItem;
                this.groupIndex = 0;
                this.item       = group;
                this.index      = 0;
                return(true);
            }

            if (this.propertyGridElement.CollectionView.Count > 0)
            {
                this.index = 0;
                this.item  = propertyGridElement.CollectionView[0];
                return(true);
            }

            return(false);
        }
Esempio n. 9
0
        private PropertyGridSpreadExportRow CreateExportRow(
            PropertyGridItemBase item,
            int itemLevel,
            int currentRowIndex,
            ref bool skipHiddenChildItems,
            ref int collapsedParentLevel,
            ref bool exportChildItemsHidden)
        {
            PropertyGridSpreadExportRow gridSpreadExportRow = new PropertyGridSpreadExportRow();

            if (!item.Expanded && this.CollapsedItemOption == HiddenOption.DoNotExport)
            {
                skipHiddenChildItems = true;
                collapsedParentLevel = itemLevel;
            }
            if (exportChildItemsHidden && collapsedParentLevel >= itemLevel)
            {
                exportChildItemsHidden = false;
            }
            if (item is PropertyGridItem)
            {
                PropertyGridItem        propertyGridItem        = item as PropertyGridItem;
                PropertyGridItemElement propertyGridItemElement = (PropertyGridItemElement)null;
                if (this.ExportVisualSettings)
                {
                    propertyGridItemElement = this.elementProvider.GetElement((PropertyGridItemBase)propertyGridItem, (object)null) as PropertyGridItemElement;
                    this.propertyGrid.PropertyGridElement.PropertyTableElement.ViewElement.Children.Add((RadElement)propertyGridItemElement);
                    propertyGridItemElement.Attach((PropertyGridItemBase)propertyGridItem, (object)null);
                }
                for (int index = 0; index < itemLevel; ++index)
                {
                    PropertyGridSpreadExportIndentCell exportIndentCell = new PropertyGridSpreadExportIndentCell();
                    exportIndentCell.Size = new Size(this.ItemIndent, exportChildItemsHidden ? 0 : -1);
                    if (this.ExportVisualSettings)
                    {
                        if (index == 0 && this.isGridGrouped)
                        {
                            if (itemLevel > 1)
                            {
                                this.GetStylesFromVisualCell((PropertyGridSpreadExportCell)exportIndentCell, (LightVisualElement)propertyGridItemElement.HeaderElement);
                            }
                            else
                            {
                                this.GetStylesFromVisualCell((PropertyGridSpreadExportCell)exportIndentCell, (LightVisualElement)propertyGridItemElement.ExpanderElement);
                            }
                        }
                        else
                        {
                            this.GetStylesFromVisualCell((PropertyGridSpreadExportCell)exportIndentCell, (LightVisualElement)propertyGridItemElement.IndentElement);
                        }
                        this.GetBordersFromVisualCell((PropertyGridSpreadExportCell)exportIndentCell, (LightVisualElement)propertyGridItemElement);
                    }
                    this.OnCellFormatting(new PropertyGridSpreadExportCellFormattingEventArgs((PropertyGridSpreadExportCell)exportIndentCell, (PropertyGridItemBase)propertyGridItem, currentRowIndex));
                    gridSpreadExportRow.Cells.Add((PropertyGridSpreadExportCell)exportIndentCell);
                }
                PropertyGridSpreadExportContentCell exportContentCell1 = new PropertyGridSpreadExportContentCell();
                exportContentCell1.Text     = propertyGridItem.Label;
                exportContentCell1.ColSpan += this.depthOfTree - propertyGridItem.Level;
                exportContentCell1.Size     = new Size(this.textCellWidth - itemLevel * this.ItemIndent, exportChildItemsHidden ? 0 : -1);
                gridSpreadExportRow.Cells.Add((PropertyGridSpreadExportCell)exportContentCell1);
                if (this.ExportVisualSettings)
                {
                    this.GetStylesFromVisualCell((PropertyGridSpreadExportCell)exportContentCell1, (LightVisualElement)propertyGridItemElement.TextElement);
                    this.GetBordersFromVisualCell((PropertyGridSpreadExportCell)exportContentCell1, (LightVisualElement)propertyGridItemElement);
                }
                this.OnCellFormatting(new PropertyGridSpreadExportCellFormattingEventArgs((PropertyGridSpreadExportCell)exportContentCell1, (PropertyGridItemBase)propertyGridItem, currentRowIndex));
                PropertyGridSpreadExportContentCell exportContentCell2 = new PropertyGridSpreadExportContentCell();
                exportContentCell2.Value = propertyGridItem.Value;
                exportContentCell2.Text  = propertyGridItem.FormattedValue;
                exportContentCell2.Size  = new Size(this.valueCellWidth, exportChildItemsHidden ? 0 : -1);
                if (this.ExportVisualSettings)
                {
                    this.GetStylesFromVisualCell((PropertyGridSpreadExportCell)exportContentCell2, (LightVisualElement)propertyGridItemElement.ValueElement);
                    this.GetBordersFromVisualCell((PropertyGridSpreadExportCell)exportContentCell2, (LightVisualElement)propertyGridItemElement);
                }
                this.OnCellFormatting(new PropertyGridSpreadExportCellFormattingEventArgs((PropertyGridSpreadExportCell)exportContentCell2, (PropertyGridItemBase)propertyGridItem, currentRowIndex));
                gridSpreadExportRow.Cells.Add((PropertyGridSpreadExportCell)exportContentCell2);
                if (this.ExportDescriptions)
                {
                    PropertyGridSpreadExportContentCell exportContentCell3 = new PropertyGridSpreadExportContentCell();
                    exportContentCell3.Text = propertyGridItem.Description;
                    exportContentCell3.Size = new Size((this.textCellWidth + this.valueCellWidth) * 2, exportChildItemsHidden ? 0 : -1);
                    if (this.ExportVisualSettings)
                    {
                        this.GetStylesFromVisualCell((PropertyGridSpreadExportCell)exportContentCell3, (LightVisualElement)propertyGridItemElement.ValueElement);
                        this.GetBordersFromVisualCell((PropertyGridSpreadExportCell)exportContentCell3, (LightVisualElement)propertyGridItemElement);
                    }
                    this.OnCellFormatting(new PropertyGridSpreadExportCellFormattingEventArgs((PropertyGridSpreadExportCell)exportContentCell3, (PropertyGridItemBase)propertyGridItem, currentRowIndex));
                    gridSpreadExportRow.Cells.Add((PropertyGridSpreadExportCell)exportContentCell3);
                }
                if (this.ExportVisualSettings)
                {
                    this.elementProvider.CacheElement((IVirtualizedElement <PropertyGridItemBase>)propertyGridItemElement);
                    propertyGridItemElement.Detach();
                    this.propertyGrid.PropertyGridElement.PropertyTableElement.ViewElement.Children.Remove((RadElement)propertyGridItemElement);
                }
            }
            else if (item is PropertyGridGroupItem)
            {
                this.isGridGrouped = true;
                PropertyGridGroupItem    propertyGridGroupItem = item as PropertyGridGroupItem;
                PropertyGridGroupElement gridGroupElement      = (PropertyGridGroupElement)null;
                if (this.ExportVisualSettings)
                {
                    gridGroupElement = this.elementProvider.GetElement((PropertyGridItemBase)propertyGridGroupItem, (object)null) as PropertyGridGroupElement;
                    this.propertyGrid.PropertyGridElement.PropertyTableElement.ViewElement.Children.Add((RadElement)gridGroupElement);
                    gridGroupElement.Attach((PropertyGridItemBase)propertyGridGroupItem, (object)null);
                }
                PropertyGridSpreadExportContentCell exportContentCell = new PropertyGridSpreadExportContentCell();
                exportContentCell.Text = propertyGridGroupItem.Label;
                ++exportContentCell.ColSpan;
                ++exportContentCell.ColSpan;
                exportContentCell.ColSpan += this.depthOfTree;
                if (this.ExportDescriptions)
                {
                    ++exportContentCell.ColSpan;
                }
                exportContentCell.Size = new Size(this.textCellWidth + this.valueCellWidth + this.depthOfTree * this.ItemIndent, -1);
                if (this.ExportVisualSettings)
                {
                    this.GetStylesFromVisualCell((PropertyGridSpreadExportCell)exportContentCell, (LightVisualElement)gridGroupElement.TextElement);
                    this.GetBordersFromVisualCell((PropertyGridSpreadExportCell)exportContentCell, (LightVisualElement)gridGroupElement.TextElement);
                }
                this.OnCellFormatting(new PropertyGridSpreadExportCellFormattingEventArgs((PropertyGridSpreadExportCell)exportContentCell, (PropertyGridItemBase)propertyGridGroupItem, currentRowIndex));
                gridSpreadExportRow.Cells.Add((PropertyGridSpreadExportCell)exportContentCell);
                if (this.ExportVisualSettings)
                {
                    this.elementProvider.CacheElement((IVirtualizedElement <PropertyGridItemBase>)gridGroupElement);
                    gridGroupElement.Detach();
                    this.propertyGrid.PropertyGridElement.PropertyTableElement.ViewElement.Children.Remove((RadElement)gridGroupElement);
                }
            }
            if (!exportChildItemsHidden)
            {
                exportChildItemsHidden = !item.Expanded && this.CollapsedItemOption == HiddenOption.ExportAsHidden;
                collapsedParentLevel   = itemLevel;
            }
            return(gridSpreadExportRow);
        }
Esempio n. 10
0
        protected virtual bool MovePreviousFromDataItem(PropertyGridItemBase currentItem)
        {
            if (currentItem.Parent != null && currentItem.Parent.GridItems.Count > 1)
            {
                if (this.index > 0)
                {
                    PropertyGridItemBase prevItem = currentItem.Parent.GridItems[--this.index];
                    if (prevItem.Expandable && prevItem.Expanded)
                    {
                        prevItem = this.GetLastChild(prevItem);
                    }

                    this.item = prevItem;
                    return(true);
                }

                this.item  = currentItem.Parent;
                this.index = -1;
                if (currentItem.Parent.Parent != null)
                {
                    this.index = currentItem.Parent.Parent.GridItems.IndexOf(currentItem.Parent as PropertyGridItem);
                }
                else
                {
                    if (this.propertyGridElement.CollectionView.Groups.Count == 0)
                    {
                        this.index = this.propertyGridElement.CollectionView.IndexOf(currentItem.Parent as PropertyGridItem);
                    }
                    else
                    {
                        this.index = this.propertyGridElement.CollectionView.Groups[this.groupIndex].IndexOf(currentItem.Parent as PropertyGridItem);
                    }
                }
                return(true);
            }

            if (currentItem.Parent == null && this.propertyGridElement.CollectionView.Groups.Count != 0 && this.index > 0 &&
                this.index < this.propertyGridElement.CollectionView.Groups[this.groupIndex].Items.Count &&
                this.groupIndex < this.propertyGridElement.CollectionView.Groups.Count)
            {
                this.item = this.propertyGridElement.CollectionView.Groups[this.groupIndex].Items[--this.index];
                return(true);
            }

            if (currentItem.Parent == null && this.propertyGridElement.CollectionView.Groups.Count != 0 && this.index == 0)
            {
                this.group = ((PropertyGridGroup)(object)propertyGridElement.CollectionView.Groups[this.groupIndex]).GroupItem;
                this.item  = this.group;
                this.index = -1;
                return(true);
            }

            if (currentItem.Parent == null && this.propertyGridElement.CollectionView.Groups.Count == 0)
            {
                if (this.index > 0 && this.index < this.propertyGridElement.CollectionView.Count)
                {
                    PropertyGridItemBase prevItem = this.propertyGridElement.CollectionView[--this.index];
                    if (prevItem != null)
                    {
                        prevItem = this.GetLastChild(prevItem);
                    }

                    this.item = prevItem;
                    return(true);
                }
                else if (this.index == 0)
                {
                    this.Reset();
                    return(true);
                }
            }

            return(false);
        }
Esempio n. 11
0
        protected virtual bool MoveNextFromDataItem(PropertyGridItemBase currentItem, bool checkIfExpandable, bool resetIndex)
        {
            if (currentItem.Expandable && checkIfExpandable)
            {
                if (currentItem.Expanded && currentItem.GridItems.Count > 0)
                {
                    this.item  = currentItem.GridItems[0];
                    this.index = 0;
                    return(true);
                }
            }

            if (currentItem.Parent != null)
            {
                if (resetIndex)
                {
                    // check for groups
                    //if groups => check in current group
                    //else => collectionView
                    this.index = currentItem.Parent.GridItems.IndexOf(currentItem as PropertyGridItem);
                }

                if (this.index + 1 < currentItem.Parent.GridItems.Count)
                {
                    this.item = currentItem.Parent.GridItems[++this.index];
                    return(true);
                }

                return(MoveNextFromDataItem(currentItem.Parent, false, true));
            }

            if (currentItem.Parent == null && this.propertyGridElement.CollectionView.Groups.Count == 0)
            {
                if (resetIndex)
                {
                    this.index = this.propertyGridElement.CollectionView.IndexOf(currentItem as PropertyGridItem);
                }

                if (index + 1 < this.propertyGridElement.CollectionView.Count)
                {
                    this.item = this.propertyGridElement.CollectionView[++this.index];
                    return(true);
                }

                return(false);
            }

            if (currentItem.Parent == null && this.propertyGridElement.CollectionView.Groups.Count != 0)
            {
                if (resetIndex)
                {
                    this.index = this.propertyGridElement.CollectionView.Groups[this.groupIndex].IndexOf(currentItem as PropertyGridItem);
                }

                if (this.index + 1 < this.propertyGridElement.CollectionView.Groups[this.groupIndex].Items.Count)
                {
                    this.item = this.propertyGridElement.CollectionView.Groups[this.groupIndex].Items[++this.index];
                    return(true);
                }

                if (this.groupIndex + 1 < this.propertyGridElement.CollectionView.Groups.Count)
                {
                    this.group = ((PropertyGridGroup)(object)propertyGridElement.CollectionView.Groups[++this.groupIndex]).GroupItem;
                    this.item  = this.group;
                    this.index = -1;
                    return(true);
                }
            }

            return(false);
        }