需要避免在MS控件的CodedUITestBuilder属性窗口中添加自定义属性。 [英] Need to avoid the custom properties added in CodedUITestBuilder property window for MS controls.
问题描述
我准备了带有Microsoft Button控件派生的自定义控件(ButtonAdv)的简单示例(WindowsForms)。并为该自定义控件实现了CodedUI Extension支持使用我的自定义属性(BackColor和ForeColor等),通过在下面的博客中提供
,
I have prepared the simple sample(WindowsForms) with custom control(ButtonAdv) which derived from Microsoft Button control.And implemented CodedUI Extension support for that custom control with my custom properties(BackColor and ForeColor,etc) by refferring the below blog,
https://blogs.msdn.microsoft.com/devops/2011/ 10/28 / coded-ui-test-extension-for-3rd-party-windows-forms-controlshow-to /
public class SfButtonAdv1:WinControl
{
public SfButtonAdv1(UITestControl control)
: base(control)
{
SearchProperties.Add(UITestControl.PropertyNames.ControlType, ControlType.Button.Name);
}
new public abstract class PropertyNames : WinControl.PropertyNames
{
public static readonly string BackColor = "BackColor";
public static readonly string ForeColor = "ForeColor";
}
}
public class SfButtonAdv : Button
{
public SfButtonAdv()
{
}
protected override AccessibleObject CreateAccessibilityInstance()
{
return new SfButtonAccessiblity(this);
}
}
public class SfButtonAccessiblity : ControlAccessibleObject
{
//
public override string Description
{
get
{
return this.sfButtonAdv.Style.BackColor.Name
+ "," + this.sfButtonAdv.Style.ForeColor.Name
}
}
}
谢谢此致,
Piruthiviraj
Piruthiviraj
Piruthiviraj
Piruthiviraj
推荐答案
你不能。
You cannot.
那些属性在那里,所以虽然输入什么都不做但它们会被显示。
Those properties are there, so they are shown although entering does nothing.
有一些标准的Windows窗体控件,比如picturebox 也会这样做。
There are some standard windows forms controls like picturebox which do the same.
尝试使用Background属性,它完全被遮挡并且什么都不做,但无论你做什么,它都可用。
Try the Background property, it is completely shadowed and does nothing, but whatever you do, it stays available.
(请注意,属性不会隐藏此内容)
(Be aware as well the attributes don't hide this)
这篇关于需要避免在MS控件的CodedUITestBuilder属性窗口中添加自定义属性。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!