博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
TextBlock can't be find in DataTemplate when use Coded UI Test
阅读量:7024 次
发布时间:2019-06-28

本文共 905 字,大约阅读时间需要 3 分钟。

If you use textblock in DataTemplate, such as follow:

The Textblock can't be find when use Coded UI Test, Label is OK.

We need to custom textblock, as follow, and use as above.

public class AutomatableTextBlock : TextBlock    {        protected override AutomationPeer OnCreateAutomationPeer()        {            return new AutomatableTextBlockAutomationPeer(this);        }        class AutomatableTextBlockAutomationPeer : TextBlockAutomationPeer        {            public AutomatableTextBlockAutomationPeer(TextBlock owner)                : base(owner)            { }            protected override bool IsControlElementCore()            { return true; }        }    }

Details refer:

转载地址:http://vcsxl.baihongyu.com/

你可能感兴趣的文章
Git与TortoiseGit基本操作
查看>>
他们都没告诉你适配 Android N 需要注意什么
查看>>
[javaSE] 网络编程(概述)
查看>>
一个屌丝程序猿的人生(六)
查看>>
矫正自己的机器人---39
查看>>
还在用ListView?
查看>>
Hibernate基本原理(一)
查看>>
BZOJ3873 : [Ahoi2014]拼图
查看>>
自由中的规则整理笔记
查看>>
利用jquery.validate以及bootstrap的tooltip开发气泡式的表单校验组件
查看>>
fatal error C1853: '<filename>' is not a precompiled header file
查看>>
STUN和TURN技术浅析
查看>>
连接第二个 insance 到 first_local_net - 每天5分钟玩转 OpenStack(83)
查看>>
js scheme 打开手机app的方法
查看>>
【Hadoop】HADOOP 总结--思维导图
查看>>
java读写锁实现数据同步访问
查看>>
原生的社交分享
查看>>
delphi IOS 获取电池信息
查看>>
Unity3D 避免玩家作弊
查看>>
springMVC-数据的格式化
查看>>