当前位置: 首页>>代码示例>>C#>>正文


C# AutomationPeer.IsDataItemAutomationPeer方法代码示例

本文整理汇总了C#中System.Windows.Automation.Peers.AutomationPeer.IsDataItemAutomationPeer方法的典型用法代码示例。如果您正苦于以下问题:C# AutomationPeer.IsDataItemAutomationPeer方法的具体用法?C# AutomationPeer.IsDataItemAutomationPeer怎么用?C# AutomationPeer.IsDataItemAutomationPeer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Automation.Peers.AutomationPeer的用法示例。


在下文中一共展示了AutomationPeer.IsDataItemAutomationPeer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: StaticWrap

        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------
 
        #region Internal Methods

        // Wrap the found peer before shipping it over process boundary - static version for use outside ElementProxy.
        internal static ElementProxy StaticWrap(AutomationPeer peer, AutomationPeer referencePeer)
        {
            ElementProxy result = null;

            if (peer != null)
            {
                //referencePeer is well-connected, since UIA is asking us using it.
                //However we are trying to return the peer that is possibly just created on some 
                //element in the middle of un-walked tree and we need to make sure it is fully
                //"connected" or initialized before we return it to UIA.
                //This method ensures it has the right _parent and other hookup.
                peer = peer.ValidateConnected(referencePeer);
                if (peer != null)
                {
                    // Use the already created Wrapper proxy for peer if it is still alive
                    if(peer.ElementProxyWeakReference != null)
                    {
                        result = peer.ElementProxyWeakReference.Target as ElementProxy;
                    }
                    if(result == null)
                    {
                        result = new ElementProxy(peer);
                        peer.ElementProxyWeakReference = new WeakReference(result);
                    }

                    // If the peer corresponds to DataItem notify peer to add to storage to 
                    // keep reference of peers going to the UIA Client
                    if(result != null)
                    {
                        if(peer.IsDataItemAutomationPeer())
                        {
                            peer.AddToParentProxyWeakRefCache();
                        }
                    }
                }
            }

            return result;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:48,代码来源:ElementProxy.cs


注:本文中的System.Windows.Automation.Peers.AutomationPeer.IsDataItemAutomationPeer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。