积极答复者
Why the UI Spy get the runtimeID is null

问题
-
Hi all:
When I implemented the UI automation for DataGriadview, I found that: the runtimeID of cell in the datagridview is null.
The code is as followed:
public class CommonDataGridView : System.Windows.Forms.DataGridView,
IRawElementProviderFragmentRoot,
IGridProvider,
ISelectionProvider,
IScrollProvider,
ITableProvider
{
……..
int[] IRawElementProviderFragment.GetRuntimeId()
{
return null;
}
……..
}
internal class CommonDataGridViewRow :
IRawElementProviderFragmentRoot,
IRawElementProviderFragment,
ISelectionItemProvider,
IScrollItemProvider
{
……
int[] IRawElementProviderFragment.GetRuntimeId()
{
return new int[] { AutomationInteropProvider.AppendRuntimeId, _row.Index };
}
……
}
internal class CommonDataGridViewCell :
IRawElementProviderFragment,
IGridItemProvider,
IValueProvider,
ISelectionItemProvider,
IScrollItemProvider
{
……
int[] IRawElementProviderFragment.GetRuntimeId()
{
return new int[] { AutomationInteropProvider.AppendRuntimeId, _cell.ColumnIndex};
}
……
}
For CommonDataGridView and CommonDataGridViewRow, the runtimeID for them in the UISpy can be returned the right value.
But for CommonDataGridViewCell, the runtimeID in the UISpy is null.
Could anyboby help me research the above code, is there any issue in it?
Or is there any other setting for runtimeId?
Thanks very much!
答案
-
Hi,Paddy_82
I think you could set a breakpoint and watch a few of field regarding to the problem.
or press F11 to step into and a few of field regarding to the problem
周雪峰- 已标记为答案 Vicky SongMicrosoft employee, Moderator 2010年12月27日 9:35
全部回复
-
Hello Paddy_82,
Could you please translate your issue into Chinese? Here is Chinese fourm, if you want to solve your problem in English you can post your issue on English fourm. It will be a benefit to other committees.
Thanks for your understanding.
Regards,
Vicky Song [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
-
Hi,Paddy_82
I think you could set a breakpoint and watch a few of field regarding to the problem.
or press F11 to step into and a few of field regarding to the problem
周雪峰- 已标记为答案 Vicky SongMicrosoft employee, Moderator 2010年12月27日 9:35