Пример #1
0
        /// <summary>
        /// Obtain the IRawElementProviderSimple at an absolute position
        /// </summary>
        IRawElementProviderSimple IGridProvider.GetItem(int row, int column)
        {
            if (row < 0 || row >= ((IGridProvider)this).RowCount)
            {
                throw new ArgumentOutOfRangeException("row");
            }
            if (column < 0 || column >= ((IGridProvider)this).ColumnCount)
            {
                throw new ArgumentOutOfRangeException("column");
            }

            ListViewItem lvi = _listview.ItemContainerGenerator.ContainerFromIndex(row) as ListViewItem;

            //If item is virtualized, try to de-virtualize it
            if (lvi == null)
            {
                VirtualizingPanel itemsHost = _listview.ItemsHost as VirtualizingPanel;
                if (itemsHost != null)
                {
                    itemsHost.BringIndexIntoView(row);
                }

                lvi = _listview.ItemContainerGenerator.ContainerFromIndex(row) as ListViewItem;

                if (lvi != null)
                {
                    //Must call Invoke here to force run the render process
                    _listview.Dispatcher.Invoke(
                        System.Windows.Threading.DispatcherPriority.Loaded,
                        (System.Windows.Threading.DispatcherOperationCallback) delegate(object arg)
                    {
                        return(null);
                    },
                        null);
                }
            }

            //lvi is null, it is virtualized, so we can't return its cell
            if (lvi != null)
            {
                AutomationPeer lvpeer = UIElementAutomationPeer.FromElement(_listview);
                if (lvpeer != null)
                {
                    List <AutomationPeer> rows = lvpeer.GetChildren();
                    //Headers is the first child of GridView, so we need to skip it here
                    if (rows.Count - 1 > row)
                    {
                        AutomationPeer        peer    = rows[row + 1];
                        List <AutomationPeer> columns = peer.GetChildren();
                        if (columns.Count > column)
                        {
                            return(ElementProxy.StaticWrap(columns[column], lvpeer));
                        }
                    }
                }
            }

            return(null);
        }
Пример #2
0
        ///
        void IViewAutomationPeer.ItemsChanged(NotifyCollectionChangedEventArgs e)
        {
            ListViewAutomationPeer peer = UIElementAutomationPeer.FromElement(_listview) as ListViewAutomationPeer;

            if (peer != null)
            {
                if (_oldItemsCount != _listview.Items.Count)
                {
                    peer.RaisePropertyChangedEvent(GridPatternIdentifiers.RowCountProperty, _oldItemsCount, _listview.Items.Count);
                }
                _oldItemsCount = _listview.Items.Count;
            }
        }
        ///For ComboBoxItem for which peer is this element only, scrolling should happen when the pop-up is expanded.
        internal override void RealizeCore()
        {
            ComboBox parent = ItemsControlAutomationPeer.Owner as ComboBox;

            if (parent != null)
            {
                IExpandCollapseProvider iecp = (IExpandCollapseProvider)UIElementAutomationPeer.FromElement(parent) as ComboBoxAutomationPeer;
                if (iecp.ExpandCollapseState != ExpandCollapseState.Expanded)
                {
                    iecp.Expand();
                }
            }
            base.RealizeCore();
        }
Пример #4
0
        /// <summary>Returns the UI Automation provider for the specified cell.</summary>
        /// <param name="row">The ordinal number of the row of interest.</param>
        /// <param name="column">The ordinal number of the column of interest.</param>
        /// <returns>The UI Automation provider for the specified cell.</returns>
        // Token: 0x060026B4 RID: 9908 RVA: 0x000B7CA0 File Offset: 0x000B5EA0
        IRawElementProviderSimple IGridProvider.GetItem(int row, int column)
        {
            if (row < 0 || row >= ((IGridProvider)this).RowCount)
            {
                throw new ArgumentOutOfRangeException("row");
            }
            if (column < 0 || column >= ((IGridProvider)this).ColumnCount)
            {
                throw new ArgumentOutOfRangeException("column");
            }
            ListViewItem listViewItem = this._listview.ItemContainerGenerator.ContainerFromIndex(row) as ListViewItem;

            if (listViewItem == null)
            {
                VirtualizingPanel virtualizingPanel = this._listview.ItemsHost as VirtualizingPanel;
                if (virtualizingPanel != null)
                {
                    virtualizingPanel.BringIndexIntoView(row);
                }
                listViewItem = (this._listview.ItemContainerGenerator.ContainerFromIndex(row) as ListViewItem);
                if (listViewItem != null)
                {
                    this._listview.Dispatcher.Invoke(DispatcherPriority.Loaded, new DispatcherOperationCallback((object arg) => null), null);
                }
            }
            if (listViewItem != null)
            {
                AutomationPeer automationPeer = UIElementAutomationPeer.FromElement(this._listview);
                if (automationPeer != null)
                {
                    AutomationPeer automationPeer2 = UIElementAutomationPeer.FromElement(listViewItem);
                    if (automationPeer2 != null)
                    {
                        AutomationPeer eventsSource = automationPeer2.EventsSource;
                        if (eventsSource != null)
                        {
                            automationPeer2 = eventsSource;
                        }
                        List <AutomationPeer> children = automationPeer2.GetChildren();
                        if (children.Count > column)
                        {
                            return(ElementProxy.StaticWrap(children[column], automationPeer));
                        }
                    }
                }
            }
            return(null);
        }
Пример #5
0
        IRawElementProviderSimple[] ITableItemProvider.GetColumnHeaderItems()
        {
            ListView listview = _listviewAP.Owner as ListView;

            if (listview != null && listview.View is GridView)
            {
                GridView gridview = listview.View as GridView;
                if (gridview.HeaderRowPresenter != null && gridview.HeaderRowPresenter.ActualColumnHeaders.Count > Column)
                {
                    GridViewColumnHeader header = gridview.HeaderRowPresenter.ActualColumnHeaders[Column];
                    AutomationPeer       peer   = UIElementAutomationPeer.FromElement(header);
                    if (peer != null)
                    {
                        return(new IRawElementProviderSimple[] { ProviderFromPeer(peer) });
                    }
                }
            }
            return(new IRawElementProviderSimple[0]);
        }
Пример #6
0
 /// <summary>Returns a collection of UI Automation providers that represents all the column headers in a table.</summary>
 /// <returns>A collection of UI Automation providers.</returns>
 // Token: 0x060026B0 RID: 9904 RVA: 0x000B7B94 File Offset: 0x000B5D94
 IRawElementProviderSimple[] ITableProvider.GetColumnHeaders()
 {
     if (this._owner.HeaderRowPresenter != null)
     {
         List <IRawElementProviderSimple> list = new List <IRawElementProviderSimple>(this._owner.HeaderRowPresenter.ActualColumnHeaders.Count);
         ListViewAutomationPeer           listViewAutomationPeer = UIElementAutomationPeer.FromElement(this._listview) as ListViewAutomationPeer;
         if (listViewAutomationPeer != null)
         {
             foreach (UIElement element in this._owner.HeaderRowPresenter.ActualColumnHeaders)
             {
                 AutomationPeer automationPeer = UIElementAutomationPeer.CreatePeerForElement(element);
                 if (automationPeer != null)
                 {
                     list.Add(ElementProxy.StaticWrap(automationPeer, listViewAutomationPeer));
                 }
             }
         }
         return(list.ToArray());
     }
     return(new IRawElementProviderSimple[0]);
 }
Пример #7
0
        /// <summary>
        /// Collection of column headers
        /// </summary>
        IRawElementProviderSimple[] ITableProvider.GetColumnHeaders()
        {
            if (_owner.HeaderRowPresenter != null)
            {
                List <IRawElementProviderSimple> array  = new List <IRawElementProviderSimple>(_owner.HeaderRowPresenter.ActualColumnHeaders.Count);
                ListViewAutomationPeer           lvpeer = UIElementAutomationPeer.FromElement(_listview) as ListViewAutomationPeer;

                if (lvpeer != null)
                {
                    foreach (UIElement e in _owner.HeaderRowPresenter.ActualColumnHeaders)
                    {
                        AutomationPeer peer = UIElementAutomationPeer.CreatePeerForElement(e);
                        if (peer != null)
                        {
                            array.Add(ElementProxy.StaticWrap(peer, lvpeer));
                        }
                    }
                }
                return(array.ToArray());
            }

            return(new IRawElementProviderSimple[0]);
        }
        // Token: 0x0600276E RID: 10094 RVA: 0x000B9FD8 File Offset: 0x000B81D8
        internal override void RealizeCore()
        {
            ComboBox comboBox = base.ItemsControlAutomationPeer.Owner as ComboBox;

            if (comboBox != null)
            {
                IExpandCollapseProvider expandCollapseProvider = ((IExpandCollapseProvider)UIElementAutomationPeer.FromElement(comboBox)) as ComboBoxAutomationPeer;
                if (expandCollapseProvider.ExpandCollapseState != ExpandCollapseState.Expanded)
                {
                    expandCollapseProvider.Expand();
                }
            }
            base.RealizeCore();
        }
Пример #9
0
        ItemAutomationPeer IViewAutomationPeer.CreateItemAutomationPeer(object item)
        {
            ListViewAutomationPeer lvAP = UIElementAutomationPeer.FromElement(_listview) as ListViewAutomationPeer;

            return(new GridViewItemAutomationPeer(item, lvAP));
        }