1) This is my code for listbox2 selectionchanged
void PrintText2(object sender, SelectionChangedEventArgs args)
{
if (null != listBox2.SelectedItem)
{
ListBoxItem lbi = ((sender as ListBox).SelectedItem as ListBoxItem);
textBlock4.Text = lbi.Content.ToString();
}
}
2) This my code for listbox1 selecionchanged
void PrintText1(object sender, SelectionChangedEventArgs args)
{
if (null != listBox1.SelectedItem)
{
ListBoxItem l = ((sender as ListBox).SelectedItem as ListBoxItem);
textBlock6.Text = l.Content.ToString();
if (textBlock6.Text == "Angle")
{
loadlistAngle();
}
}
}
3)
void loadlistAngle()
{
listBox2.Items.Clear();
listBox2.Items.Add("Radian");
listBox2.Items.Add("Degree");
}
4) listbox1 contains static item "Angle" and on selection of "Angle" at runtime,Angle gets loaded in textBolck6 and then new items "radian" and " degree" gets added to listbox2
5) after this when I click "radian" of listbox2 ,the "radian value doesn't get loaded into textblock4 ,it gives "NullReferenceException" in "lbi.Content.ToString()"
6) how do I modify my code so that at runtime "radian" value get loaded in textblock4 and new items generated will get selected in listbox2