Core ControlDictionary doesn't recognize TextBlock

Feb 15, 2008 at 6:23 AM
I am trying to automate capturing a System.Windows.Controls.TextBlock and get the text that is already existing there.
However it appears that the White library does not recognize this control and I get a NULL referenced exception.

Source code snipet:
SearchCriteria StatusMsg = SearchCriteria.ByAutomationId("tbConnectStatus").AndControlType(typeof(System.Windows.Controls.TextBlock));

When I single step into the white source code, I think the place where we are failing is:

public virtual ControlType GetControlType(Type type)
ControlDictionaryItem foundItem =
items.Find(delegate(ControlDictionaryItem controlDictionaryItem) { return type.IsAssignableFrom(controlDictionaryItem.TestControlType); });
return foundItem.ControlType;

It appears that the ControlDictionaryItem does not recognize the TextBlock control and which is why the problem occurs.
Has anyone tried to automate using the TextBlock control? If so can you suggest any workarounds / alternative to this problem?

Thanks in advance.