Once again, I am new to Silverlight and trying my best to learn it quickly. I have a basic form that has a comboBox (comboBox1 in the example). This comboBox has items that are populated by a webservice, and that is working great. I am used to ASPX pages where I can use the "SelectionChanged" event and it actually fires when the selection changes. With Silverlight, the "SelectionChanged" event seems to fire on the inital load on the applicaiton as well.
Anyway, on the code behind example below, I am getting a null reference exception on line 4. The compiler doesn't seem to know anything about the combobox. How do I access the "SelectedIndex" property of the XAML ComboBox from the codebehind page?
private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
if (this.comboBox1.SelectedIndex != 0)
Service1SoapClient wRef = new Service1SoapClient();
wRef.GetSiteDetailsCompleted += new EventHandler<GetSiteDetailsCompletedEventArgs>(wRef_GetSiteDetailsCompleted);
string site = "MySite";