Exemplo n.º 1
0
        private PropertyGridExportState SavePropertyGridState()
        {
            PropertyGridExportState propertyGridExportState = new PropertyGridExportState()
            {
                SelectedItem = this.propertyGrid.SelectedGridItem, HorizontalScrollbarValue = this.propertyGrid.PropertyGridElement.PropertyTableElement.HScrollBar.Value, VerticalScrolbarValue = this.propertyGrid.PropertyGridElement.PropertyTableElement.VScrollBar.Value
            };

            this.propertyGrid.SelectedGridItem = (PropertyGridItemBase)null;
            int num = 0;
            Queue <PropertyGridItemBase> propertyGridItemBaseQueue = new Queue <PropertyGridItemBase>();

            foreach (PropertyGridItemBase propertyGridItemBase in (ReadOnlyCollection <PropertyGridItem>) this.propertyGrid.Items)
            {
                propertyGridItemBaseQueue.Enqueue(propertyGridItemBase);
            }
            while (propertyGridItemBaseQueue.Count > 0)
            {
                PropertyGridItemBase propertyGridItemBase = propertyGridItemBaseQueue.Dequeue();
                if (propertyGridItemBase.Level > num)
                {
                    num = propertyGridItemBase.Level;
                }
                foreach (PropertyGridItemBase gridItem in (ReadOnlyCollection <PropertyGridItem>)propertyGridItemBase.GridItems)
                {
                    propertyGridItemBaseQueue.Enqueue(gridItem);
                }
            }
            this.depthOfTree = num;
            return(propertyGridExportState);
        }
 public PropertyGridContextMenuOpeningEventArgs(
     PropertyGridItemBase item,
     RadContextMenu contextMenu)
     : base(item)
 {
     this.menu = contextMenu;
 }
Exemplo n.º 3
0
 public PropertyGridItemValueChangingEventArgs(
     PropertyGridItemBase item,
     object newValue,
     object oldValue)
     : base(newValue, oldValue)
 {
     this.item = item;
 }
Exemplo n.º 4
0
 public PropertyGridSpreadExportCellFormattingEventArgs(
     PropertyGridSpreadExportCell exportCell,
     PropertyGridItemBase item,
     int rowIndex)
 {
     this.exportCell = exportCell;
     this.item       = item;
     this.rowIndex   = rowIndex;
 }
Exemplo n.º 5
0
        private string GetLongPropertyName(PropertyGridItemBase item)
        {
            string retVal = item.Name;

            if (item.Parent != null)
            {
                retVal = String.Format("{0}.{1}", GetLongPropertyName(item.Parent), item.Name);
            }

            return(retVal);
        }
Exemplo n.º 6
0
 public PropertyGridTraverserState(
     PropertyGridGroupItem group,
     PropertyGridItemBase item,
     int index,
     int groupIndex)
 {
     this.group      = group;
     this.item       = item;
     this.index      = index;
     this.groupIndex = groupIndex;
 }
Exemplo n.º 7
0
        private void ExportToStream(Stream stream)
        {
            this.spreadExportRenderer.AddWorksheet(this.SheetName);
            int num = 0;
            PropertyGridTraverser propertyGridTraverser = new PropertyGridTraverser(this.propertyGrid.PropertyGridElement.PropertyTableElement);

            propertyGridTraverser.TraverseHirarchy = true;
            bool skipHiddenChildItems   = false;
            bool exportChildItemsHidden = false;
            int  collapsedParentLevel   = 0;

            this.valueCellWidth = this.propertyGrid.PropertyGridElement.SplitElement.PropertyTableElement.ValueColumnWidth;
            this.textCellWidth  = this.propertyGrid.PropertyGridElement.PropertyTableElement.Size.Width - this.propertyGrid.PropertyGridElement.PropertyTableElement.VScrollBar.Size.Width - this.valueCellWidth;
            if (this.ExportChildItemsGrouped)
            {
                this.InitializeRowGroupDataStructures();
            }
            while (propertyGridTraverser.MoveNext())
            {
                if (this.applicationDoEvents)
                {
                    Application.DoEvents();
                }
                if (num > this.sheetMaxRowsNumber)
                {
                    this.spreadExportRenderer.AddWorksheet(this.SheetName);
                    num = 0;
                    this.columnWidths.Clear();
                }
                PropertyGridItemBase current = propertyGridTraverser.Current;
                int level = current.Level;
                if (current is PropertyGridItem && this.isGridGrouped)
                {
                    ++level;
                }
                if (!skipHiddenChildItems || collapsedParentLevel >= level)
                {
                    skipHiddenChildItems = false;
                    this.AddRow(this.CreateExportRow(current, level, num, ref skipHiddenChildItems, ref collapsedParentLevel, ref exportChildItemsHidden), num);
                    if (this.ExportChildItemsGrouped)
                    {
                        this.ProcessCurrentRowGrouping(level, num);
                    }
                    ++num;
                }
            }
            if (this.ExportChildItemsGrouped)
            {
                this.GroupWorksheetRows(num);
            }
            this.spreadExportRenderer.CallWorkbookCreated();
            this.spreadExportRenderer.Export(stream);
        }
Exemplo n.º 8
0
        void radPropertyGrid1_PropertyValueChanging(object sender, PropertyGridItemValueChangingEventArgs e)
        {
            if ((((PropertyGridItem)e.Item)).ReadOnly || ((PropertyGridItem)e.Item).Accessor is Telerik.WinControls.UI.PropertyGridData.ImmutableItemAccessor)
            {
                return;
            }

            PropertyGridItemBase item = e.Item;
            string propertyName       = item.Name;

            while (item.Parent != null)
            {
                propertyName = item.Parent.Name + "." + propertyName;
                item         = item.Parent;
            }

            Telerik.WinControls.UI.Diagrams.UndoRedoHelper.ValueChanged((IDiagramItem)this.radDiagram1.DiagramElement.SelectedItem, propertyName, e.NewValue, e.OldValue);
        }
Exemplo n.º 9
0
        private List <PropertyGridSpreadExportRow> GetPropertyGridDataSnapshot()
        {
            List <PropertyGridSpreadExportRow> gridSpreadExportRowList = new List <PropertyGridSpreadExportRow>();

            if (this.ExportVisualSettings)
            {
                this.elementProvider = this.propertyGrid.PropertyGridElement.PropertyTableElement.ViewElement.ElementProvider as PropertyGridItemElementProvider;
            }
            int num = 0;
            PropertyGridTraverser propertyGridTraverser = new PropertyGridTraverser(this.propertyGrid.PropertyGridElement.PropertyTableElement);

            propertyGridTraverser.TraverseHirarchy = true;
            bool skipHiddenChildItems   = false;
            bool exportChildItemsHidden = false;
            int  collapsedParentLevel   = 0;

            this.valueCellWidth = this.propertyGrid.PropertyGridElement.SplitElement.PropertyTableElement.ValueColumnWidth;
            this.textCellWidth  = this.propertyGrid.PropertyGridElement.PropertyTableElement.Size.Width - this.propertyGrid.PropertyGridElement.PropertyTableElement.VScrollBar.Size.Width - this.valueCellWidth;
            if (this.ExportChildItemsGrouped)
            {
                this.InitializeRowGroupDataStructures();
            }
            while (propertyGridTraverser.MoveNext())
            {
                PropertyGridItemBase current = propertyGridTraverser.Current;
                int level = current.Level;
                if (current is PropertyGridItem && this.isGridGrouped)
                {
                    ++level;
                }
                if (!skipHiddenChildItems || collapsedParentLevel >= level)
                {
                    skipHiddenChildItems = false;
                    PropertyGridSpreadExportRow exportRow = this.CreateExportRow(current, level, num, ref skipHiddenChildItems, ref collapsedParentLevel, ref exportChildItemsHidden);
                    gridSpreadExportRowList.Add(exportRow);
                    if (this.ExportChildItemsGrouped)
                    {
                        this.ProcessCurrentRowGrouping(level, num);
                    }
                    ++num;
                }
            }
            return(gridSpreadExportRowList);
        }
 public PropertyGridItemValueChangedEventArgs(PropertyGridItemBase item)
     : base(item)
 {
 }
Exemplo n.º 11
0
 public PropertyGridItemEditingEventArgs(PropertyGridItemBase item, IValueEditor editor)
     : base(item)
 {
     this.editor = editor;
 }
Exemplo n.º 12
0
        public override bool IsCompatible(PropertyGridItemBase data, object context)
        {
            PropertyGridItem item = data as PropertyGridItem;

            return(item != null && item.PropertyType == typeof(string));
        }
Exemplo n.º 13
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);
        }
 public PropertyValidatedEventArgs(PropertyGridItemBase item)
     : base(item)
 {
 }
 public PropertyValidatingEventArgs(PropertyGridItemBase item, object newValue, object oldValue)
     : base(item, newValue, oldValue)
 {
 }