public PropertyGridTraverserState(PropertyGridGroupItem group, PropertyGridItemBase item, int index, int groupIndex) { this.group = group; this.item = item; this.index = index; this.groupIndex = groupIndex; }
public PropertyGridGroupAccessibleObject( PropertyGridGroupItem group, RadPropertyGridAccessibilityInstance parent) : base(parent) { this.group = group; }
protected override SizeF MeasureOverride(SizeF availableSize) { SizeF desiredSize = Size.Empty; PropertyGridGroupElement visualItem = this.VisualItem as PropertyGridGroupElement; PropertyGridTableElement propertyGridTableElement = this.PropertyGridTableElement; if (propertyGridTableElement != null && visualItem != null) { PropertyGridGroupItem groupDataItem = visualItem.Data as PropertyGridGroupItem; if (groupDataItem != null) { desiredSize.Width = propertyGridTableElement.ItemIndent; if (float.IsPositiveInfinity(availableSize.Height)) { desiredSize.Height = propertyGridTableElement.ItemHeight; } else { desiredSize.Height = availableSize.Height; } } } return(desiredSize); }
public void Reset() { this.item = (PropertyGridItemBase)null; this.group = (PropertyGridGroupItem)null; this.index = -1; this.groupIndex = -1; }
public PropertyGridGroup(object key, Group <PropertyGridItem> parent, PropertyGridTableElement propertyGridElement) : base(key, parent) { this.groupData = new PropertyGridGroupItem(propertyGridElement, this); this.groupData.SuspendPropertyNotifications(); this.groupData.Expanded = propertyGridElement.AutoExpandGroups; this.groupData.ResumePropertyNotifications(); }
protected virtual bool MoveNextFromDataItem( PropertyGridItemBase currentItem, bool checkIfExpandable, bool resetIndex) { if (currentItem.Expandable && checkIfExpandable && currentItem.GridItems.Count > 0 && (currentItem.Expanded || this.TraverseHirarchy)) { this.item = (PropertyGridItemBase)currentItem.GridItems[0]; this.index = 0; return(true); } if (currentItem.Parent != null) { if (resetIndex) { this.index = currentItem.Parent.GridItems.IndexOf(currentItem as PropertyGridItem); } if (this.index + 1 >= currentItem.Parent.GridItems.Count) { return(this.MoveNextFromDataItem(currentItem.Parent, false, true)); } this.item = (PropertyGridItemBase)currentItem.Parent.GridItems[++this.index]; return(true); } if (currentItem.Parent == null && this.propertyGridElement.CollectionView.Groups.Count == 0) { if (resetIndex) { this.index = this.propertyGridElement.CollectionView.IndexOf(currentItem as PropertyGridItem); } if (this.index + 1 >= this.propertyGridElement.CollectionView.Count) { return(false); } this.item = (PropertyGridItemBase)this.propertyGridElement.CollectionView[++this.index]; return(true); } 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].GetItems().Count) { this.item = (PropertyGridItemBase)this.propertyGridElement.CollectionView.Groups[this.groupIndex].GetItems()[++this.index]; return(true); } if (this.groupIndex + 1 < this.propertyGridElement.CollectionView.Groups.Count) { this.group = ((PropertyGridGroup)this.propertyGridElement.CollectionView.Groups[++this.groupIndex]).GroupItem; this.item = (PropertyGridItemBase)this.group; this.index = -1; return(true); } } return(false); }
public virtual void Synchronize() { if (this.VisualItem is PropertyGridItemElement) { PropertyGridItemElement visualItem = VisualItem as PropertyGridItemElement; if (visualItem != null) { this.IsExpanded = visualItem.Data.Expanded; this.IsSelected = visualItem.IsSelected; PropertyGridItem dataItem = visualItem.Data as PropertyGridItem; if (dataItem.Expandable) { this.expanderItem.Visibility = ElementVisibility.Visible; } else { this.expanderItem.Visibility = ElementVisibility.Hidden; } } bool isInEditMode = visualItem.IsInEditMode; if (isInEditMode && visualItem.Data.Level == 0 && visualItem.Data.GridItems.Count > 0) { isInEditMode = false; } this.SetValue(IsInEditModeProperty, isInEditMode); } if (this.VisualItem is PropertyGridGroupElement) { PropertyGridGroupElement visualItem = VisualItem as PropertyGridGroupElement; if (visualItem != null) { this.IsExpanded = visualItem.Data.Expanded; this.IsSelected = visualItem.IsSelected; PropertyGridGroupItem dataItem = visualItem.Data as PropertyGridGroupItem; if (dataItem.GridItems.Count == 0) { this.expanderItem.Visibility = ElementVisibility.Hidden; } else { this.expanderItem.Visibility = ElementVisibility.Visible; } } } this.UpdateSignImage(); }
int IReadOnlyCollection <PropertyGridItemBase> .IndexOf( PropertyGridItemBase value) { PropertyGridGroupItem propertyGridGroupItem = value as PropertyGridGroupItem; if (propertyGridGroupItem == null) { return(-1); } return(this.IndexOf((Group <PropertyGridItem>)propertyGridGroupItem.Group)); }
bool IReadOnlyCollection <PropertyGridItemBase> .Contains( PropertyGridItemBase value) { PropertyGridGroupItem propertyGridGroupItem = value as PropertyGridGroupItem; if (propertyGridGroupItem == null) { return(false); } return(this.IndexOf((Group <PropertyGridItem>)propertyGridGroupItem.Group) >= 0); }
public IEnumerator GetEnumerator() { if (this.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((IEnumerator)this.enumerator); }
public override void Attach(PropertyGridItemBase data, object context) { PropertyGridGroupItem propertyGridGroupItem = data as PropertyGridGroupItem; if (propertyGridGroupItem == null) { return; } this.item = propertyGridGroupItem; this.textElement.Text = data.Label; this.item.PropertyChanged += new PropertyChangedEventHandler(((PropertyGridItemElementBase)this).item_PropertyChanged); this.Synchronize(); }
/// <summary> /// Attaches a logical item to this visual element. /// </summary> /// <param name="data">The logical item.</param> /// <param name="context">The context.</param> public override void Attach(PropertyGridItemBase data, object context) { PropertyGridGroupItem dataItem = data as PropertyGridGroupItem; if (dataItem != null) { this.item = dataItem; this.textElement.Text = data.Label; this.item.PropertyChanged += new PropertyChangedEventHandler(item_PropertyChanged); this.Synchronize(); } }
protected virtual bool MovePreviousFromDataItem(PropertyGridItemBase currentItem) { if (currentItem.Parent != null && currentItem.Parent.GridItems.Count > 0) { if (this.index > 0) { PropertyGridItemBase currentItem1 = (PropertyGridItemBase)currentItem.Parent.GridItems[--this.index]; if (currentItem1.Expandable && (currentItem1.Expanded || this.TraverseHirarchy)) { currentItem1 = this.GetLastChild(currentItem1); } this.item = currentItem1; return(true); } this.item = currentItem.Parent; this.index = -1; this.index = currentItem.Parent.Parent == null ? (this.propertyGridElement.CollectionView.Groups.Count != 0 ? this.propertyGridElement.CollectionView.Groups[this.groupIndex].IndexOf(currentItem.Parent as PropertyGridItem) : this.propertyGridElement.CollectionView.IndexOf(currentItem.Parent as PropertyGridItem)) : currentItem.Parent.Parent.GridItems.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].GetItems().Count) && this.groupIndex < this.propertyGridElement.CollectionView.Groups.Count) { this.item = (PropertyGridItemBase)this.propertyGridElement.CollectionView.Groups[this.groupIndex].GetItems()[--this.index]; return(true); } if (currentItem.Parent == null && this.propertyGridElement.CollectionView.Groups.Count != 0 && this.index == 0) { this.group = ((PropertyGridGroup)this.propertyGridElement.CollectionView.Groups[this.groupIndex]).GroupItem; this.item = (PropertyGridItemBase)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 lastChild = (PropertyGridItemBase)this.propertyGridElement.CollectionView[--this.index]; if (lastChild != null) { lastChild = this.GetLastChild(lastChild); } this.item = lastChild; return(true); } if (this.index == 0) { this.Reset(); return(true); } } return(false); }
protected virtual bool MoveNextFromGroupItem(PropertyGridGroupItem currentGroup) { if ((currentGroup.Expanded || this.TraverseHirarchy) && currentGroup.GridItems.Count > 0) { this.item = (PropertyGridItemBase)currentGroup.GridItems[0]; this.index = 0; return(true); } if (this.groupIndex + 1 >= this.propertyGridElement.CollectionView.Groups.Count) { return(false); } this.group = ((PropertyGridGroup)this.propertyGridElement.CollectionView.Groups[++this.groupIndex]).GroupItem; this.item = (PropertyGridItemBase)this.group; return(true); }
public bool MoveToFirst() { if (this.propertyGridElement.CollectionView.Groups.Count > 0) { this.group = ((PropertyGridGroup)this.propertyGridElement.CollectionView.Groups[0]).GroupItem; this.groupIndex = 0; this.item = (PropertyGridItemBase)this.group; this.index = 0; return(true); } if (this.propertyGridElement.CollectionView.Count <= 0) { return(false); } this.index = 0; this.item = (PropertyGridItemBase)this.propertyGridElement.CollectionView[0]; return(true); }
protected virtual bool MovePreviousFromGroupItem(PropertyGridGroupItem currentGroup) { if (this.groupIndex > 0) { PropertyGridGroupItem groupItem = ((PropertyGridGroup)this.propertyGridElement.CollectionView.Groups[--this.groupIndex]).GroupItem; if (groupItem.Expanded || this.TraverseHirarchy) { this.index = groupItem.GridItems.Count - 1; this.item = this.GetLastChild((PropertyGridItemBase)groupItem.GridItems[this.index]); return(true); } this.group = groupItem; this.item = (PropertyGridItemBase)this.group; this.index = -1; return(true); } if (this.groupIndex != 0) { return(false); } this.Reset(); return(true); }
/// <summary> /// Detaches the currently attached logical item. /// </summary> public override void Detach() { this.item.PropertyChanged -= new PropertyChangedEventHandler(item_PropertyChanged); this.item = null; }
public override void Detach() { this.item.PropertyChanged -= new PropertyChangedEventHandler(((PropertyGridItemElementBase)this).item_PropertyChanged); this.item = (PropertyGridGroupItem)null; }