如何从自定义控件获取文本值 [英] How to get Text Value from Custom Controls
问题描述
我正在使用WPFTable,并尝试从中获取单元格值。但我面临的问题是表中的每个Cell都被标识为WPFCustom Control和 我正在使用的控件的详细信息。 WPFTable :(表格) ClassName - Uia.ListView ControlType - 表 WPFControl :(行) ClassName - Uia.ListViewItem ControlType - DataItem WPFCustom :(单元格) ClassName - Uia.ContentPresenter 控制类型–自定义 请有人帮我从自定义控件中获取文本值。
,它没有任何单一属性,我可以从中检索文本值。我尝试使用UISpy但发现相同并且没有得到属性或模式来获取文本值。
Brajpal Jangir
Cell的Name / AutomationId返回什么(对于Coded UI以及UISpy)?您能将Cell的Name / AutomationId或任何其他AutomationProperty与Text Value相关联吗?一旦这样做,您就可以访问Text Value。另外,
check a相关博客:
http://blogs.msdn.com/b/gautamg/archive/2010/03/23/writing-extension-for-wpf-custom-control.aspx
I am working with WPFTable, and trying to get the cell value from that. But the problem I am facing is that each Cell in the table is identified as WPFCustom Control and
which does not have any single property from which I can retrieve the Text Value. I tried with UISpy but found the same and did not get property or pattern to get the Text Value.
Detail of controls I am working with. WPFTable: (Table) ClassName - Uia.ListView ControlType - Table WPFControl: (Row) ClassName - Uia.ListViewItem ControlType - DataItem WPFCustom: (Cell) ClassName - Uia.ContentPresenter Control Type – Custom Please can someone help me to get the Text value from Custom control.
Brajpal Jangir
What does the Name/AutomationId of the Cell return (for Coded UI as well as UISpy) ? Would you be able to associate the Cell's Name/AutomationId or any other AutomationProperty with the Text Value ? Once you do that, you can access the Text Value. Also, check a related blog here : http://blogs.msdn.com/b/gautamg/archive/2010/03/23/writing-extension-for-wpf-custom-control.aspx
这篇关于如何从自定义控件获取文本值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!