/// <summary> /// Gets the position of a MenuItem contained in a set. /// </summary> /// <remarks> /// If this value has already been set by the developer, that value will be used for this property. If it hasn't, we find the position ourselves. /// </remarks> /// <returns> /// The position of a MenuItem that is contained in a set. /// </returns> override protected int GetPositionInSetCore() { int positionInSet = base.GetPositionInSetCore(); if (positionInSet == AutomationProperties.AutomationPositionInSetDefault) { MenuItem owner = (MenuItem)Owner; ItemsControl parent = ItemsControl.ItemsControlFromItemContainer(owner); positionInSet = ItemAutomationPeer.GetPositionInSetFromItemsControl(parent, owner); foreach (var item in parent.Items) { if (item == owner) { break; } if (item is Separator) { positionInSet -= 1; } } } return(positionInSet); }
// Token: 0x06002787 RID: 10119 RVA: 0x000BA214 File Offset: 0x000B8414 protected override int GetPositionInSetCore() { int num = base.GetPositionInSetCore(); if (num == -1) { MenuItem menuItem = (MenuItem)base.Owner; ItemsControl itemsControl = ItemsControl.ItemsControlFromItemContainer(menuItem); num = ItemAutomationPeer.GetPositionInSetFromItemsControl(itemsControl, menuItem); } return(num); }
/// <summary> /// Gets the position of a MenuItem contained in a set. /// </summary> /// <remarks> /// If this value has already been set by the developer, that value will be used for this property. If it hasn't, we find the position ourselves. /// </remarks> /// <returns> /// The position of a MenuItem that is contained in a set. /// </returns> override protected int GetPositionInSetCore() { int positionInSet = base.GetPositionInSetCore(); if (positionInSet == AutomationProperties.AutomationPositionInSetDefault) { MenuItem owner = (MenuItem)Owner; ItemsControl parent = ItemsControl.ItemsControlFromItemContainer(owner); positionInSet = ItemAutomationPeer.GetPositionInSetFromItemsControl(parent, owner); } return(positionInSet); }
// Token: 0x06002712 RID: 10002 RVA: 0x000B8CE4 File Offset: 0x000B6EE4 protected override int GetPositionInSetCore() { AutomationPeer wrapperPeer = this.GetWrapperPeer(); if (wrapperPeer != null) { int num = wrapperPeer.GetPositionInSet(); if (num == -1) { ItemsControl itemsControl = (ItemsControl)this.ItemsControlAutomationPeer.Owner; num = ItemAutomationPeer.GetPositionInSetFromItemsControl(itemsControl, this.Item); } return(num); } this.ThrowElementNotAvailableException(); return(-1); }