views:

43

answers:

1

In my Silverlight page I have a combobox. In the code-behind I'm filling the combobox items like so:

this.ProblemList.Items.Add(Strings.Review_SelectProblem);
this.ProblemList.Items.Add(Strings.Review_IncorrectCharacters);
this.ProblemList.Items.Add(Strings.Review_MissingText);
...
this.ProblemList.SelectedIndex = 0; //Set the default selection

Elsewhere, in my XAML page I am providing accessibility (for the disabled) to other non-combobox controls by doing this:

AutomationProperties.Name="{Binding Strings.Review_Access_ParagraphCorrect}"

I'd like to provide Accessibility to my combobox items but the only way I've been able to find is like so:

AutomationProperties.SetLabeledBy(this.nameInput, this.nameLabel);

The problem with this is that my combobox items must have a name. How do I assign a name to my combobox items programmaticly or how can I provide accessibility in the code behind with out referencing the name of the combobox items?

Thank you for your help,

Aaron

A: 

You can try to use something like this:

ComboBoxItem tmpItem = new ComboBoxItem();
tmpItem.Content = Strings.Review_SelectProblem;
tmpItem.Name = Strings.Review_SelectProblem;
this.ProblemList.Items.Add(tmpItem);

I hope I understood you correctly.

MyFaJoArCo