// Token: 0x06002786 RID: 10118 RVA: 0x000BA1E0 File Offset: 0x000B83E0 protected override int GetSizeOfSetCore() { int num = base.GetSizeOfSetCore(); if (num == -1) { MenuItem menuItem = (MenuItem)base.Owner; ItemsControl itemsControl = ItemsControl.ItemsControlFromItemContainer(menuItem); num = ItemAutomationPeer.GetSizeOfSetFromItemsControl(itemsControl, menuItem); } return(num); }
/// <summary> /// Gets the size of a set that contains this MenuItem. /// </summary> /// <remarks> /// If <see cref="AutomationProperties.PositionInSetProperty"/> hasn't been set /// this method will calculate the position of the MenuItem based on its parent ItemsControl, /// if the ItemsControl is grouping the position will be relative to the group containing this item. /// </remarks> /// <returns> /// The value of <see cref="AutomationProperties.PositionInSetProperty"/> if it has been set, or it's position relative to the parent ItemsControl or GroupItem. /// </returns> override protected int GetSizeOfSetCore() { int sizeOfSet = base.GetSizeOfSetCore(); if (sizeOfSet == AutomationProperties.AutomationSizeOfSetDefault) { MenuItem owner = (MenuItem)Owner; ItemsControl parent = ItemsControl.ItemsControlFromItemContainer(owner); sizeOfSet = ItemAutomationPeer.GetSizeOfSetFromItemsControl(parent, owner); } return(sizeOfSet); }
// Token: 0x06002713 RID: 10003 RVA: 0x000B8D30 File Offset: 0x000B6F30 protected override int GetSizeOfSetCore() { AutomationPeer wrapperPeer = this.GetWrapperPeer(); if (wrapperPeer != null) { int num = wrapperPeer.GetSizeOfSet(); if (num == -1) { ItemsControl itemsControl = (ItemsControl)this.ItemsControlAutomationPeer.Owner; num = ItemAutomationPeer.GetSizeOfSetFromItemsControl(itemsControl, this.Item); } return(num); } this.ThrowElementNotAvailableException(); return(-1); }
/// <summary> /// Gets the size of a set that contains this MenuItem. /// </summary> /// <remarks> /// If <see cref="AutomationProperties.PositionInSetProperty"/> hasn't been set /// this method will calculate the position of the MenuItem based on its parent ItemsControl, /// if the ItemsControl is grouping the position will be relative to the group containing this item. /// </remarks> /// <returns> /// The value of <see cref="AutomationProperties.PositionInSetProperty"/> if it has been set, or it's position relative to the parent ItemsControl or GroupItem. /// </returns> override protected int GetSizeOfSetCore() { int sizeOfSet = base.GetSizeOfSetCore(); if (sizeOfSet == AutomationProperties.AutomationSizeOfSetDefault) { MenuItem owner = (MenuItem)Owner; ItemsControl parent = ItemsControl.ItemsControlFromItemContainer(owner); sizeOfSet = ItemAutomationPeer.GetSizeOfSetFromItemsControl(parent, owner); foreach (var item in parent.Items) { if (item is Separator) { sizeOfSet -= 1; } } } return(sizeOfSet); }