Esempio n. 1
0
        /// <summary>
        /// Provides a value for UIAutomation's PositionInSet property
        /// Reads <see cref="AutomationProperties.PositionInSetProperty"/> and returns the value if one was provided,
        /// otherwise it attempts to calculate one.
        /// </summary>
        override protected int GetPositionInSetCore()
        {
            int positionInSet = AutomationProperties.GetPositionInSet(_owner);

            if (positionInSet == AutomationProperties.AutomationPositionInSetDefault)
            {
                // If a value has been set for <see cref="UIElement.PositionAndSizeOfSetController"/>
                // forward the call to that element, otherwise return the default value.
                UIElement element = _owner.PositionAndSizeOfSetController;
                if (element != null)
                {
                    AutomationPeer peer = UIElementAutomationPeer.FromElement(element);
                    peer = peer.EventsSource ?? peer;
                    if (peer != null)
                    {
                        try
                        {
                            positionInSet = peer.GetPositionInSet();
                        }
                        catch (ElementNotAvailableException)
                        {
                            positionInSet = AutomationProperties.AutomationPositionInSetDefault;
                        }
                    }
                }
            }

            return(positionInSet);
        }
Esempio n. 2
0
        // Token: 0x06002639 RID: 9785 RVA: 0x000B6620 File Offset: 0x000B4820
        protected override int GetPositionInSetCore()
        {
            AutomationPeer wrapperPeer = this.WrapperPeer;

            if (wrapperPeer != null)
            {
                return(wrapperPeer.GetPositionInSet());
            }
            this.ThrowElementNotAvailableException();
            return(-1);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the position of a this DateTime element within a set.
        /// </summary>
        /// <remarks>
        /// Forwards the call to the wrapperPeer.
        /// </remarks>
        /// <returns>
        /// The PositionInSet property value from the wrapper peer
        /// </returns>
        protected override int GetPositionInSetCore()
        {
            AutomationPeer wrapperPeer = WrapperPeer;

            if (wrapperPeer != null)
            {
                return(wrapperPeer.GetPositionInSet());
            }
            else
            {
                ThrowElementNotAvailableException();
            }

            return(AutomationProperties.AutomationPositionInSetDefault);
        }
        // Token: 0x06002593 RID: 9619 RVA: 0x000B4A3C File Offset: 0x000B2C3C
        protected override int GetPositionInSetCore()
        {
            AutomationPeer owningCellPeer = this.OwningCellPeer;
            int            result         = -1;

            if (owningCellPeer != null)
            {
                result = owningCellPeer.GetPositionInSet();
            }
            else
            {
                this.ThrowElementNotAvailableException();
            }
            return(result);
        }
        /// <summary>
        /// Gets the position of this DataGridCellItem within a set.
        /// </summary>
        /// <remarks>
        /// Forwards the call to the wrapperPeer.
        /// </remarks>
        /// <returns>
        /// The PositionInSet property value from the wrapper peer
        /// </returns>
        protected override int GetPositionInSetCore()
        {
            AutomationPeer wrapperPeer = OwningCellPeer;
            int            position    = AutomationProperties.AutomationPositionInSetDefault;

            if (wrapperPeer != null)
            {
                position = wrapperPeer.GetPositionInSet();
            }
            else
            {
                ThrowElementNotAvailableException();
            }

            return(position);
        }
Esempio n. 6
0
        // 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);
        }
        /// <summary>
        /// Gets the position of an item within a set.
        /// </summary>
        /// <remarks>
        /// If <see cref="AutomationProperties.PositionInSetProperty"/> hasn't been set
        /// this method will calculate the position of an item 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>
        protected override int GetPositionInSetCore()
        {
            AutomationPeer wrapperPeer = GetWrapperPeer();

            if (wrapperPeer != null)
            {
                int position = wrapperPeer.GetPositionInSet();

                if (position == AutomationProperties.AutomationPositionInSetDefault)
                {
                    ItemsControl parentItemsControl = (ItemsControl)ItemsControlAutomationPeer.Owner;
                    position = GetPositionInSetFromItemsControl(parentItemsControl, Item);
                }

                return(position);
            }
            else
            {
                ThrowElementNotAvailableException();
            }

            return(AutomationProperties.AutomationPositionInSetDefault);
        }