Verify All Text in a Silverlight ComboBox

PROBLEM

I would like to verify all the text at once in a Silverlight ComboBox.

SOLUTION

This is possible with a coded solution. The example below is against this Silverlight demo site.

 

After navigating there, click DataForm in the left-hand menu. Then open the CommandButtonsVisibility ComboBox. Finally, add a coded step:

 

Note: TextContent is deprecated as of version 2011.2.1229. Use TextBlockContent on the parent element to recursively search for the text within its children.
      Click here to show code for an earlier version using TextContent.

 

C#

ComboBox cb = Pages.SilverlightToolkitSamples.SilverlightApp.Item0Combobox;
 
string full = cb.TextBlockContent.ToString();
full = full.Trim();
 
Log.WriteLine(full);
Assert.AreEqual(full, "All Add Delete Edit Navigation None");

 

Visual Basic

Dim cb As ComboBox = Pages.SilverlightToolkitSamples.SilverlightApp.Item0Combobox
 
Dim full As String = cb.TextBlockContent.ToString()
full = full.Trim()
 
Log.WriteLine(full)
Assert.AreEqual(full, "All Add Delete Edit Navigation None")