This compiles just fine but blows up in the iOS simulator when the view loads:
public MyTestPage()
{
InitializeComponent();
int i = 1; int iLen = 16;
for (i = 1; i <= iLen; i++) {
Label label =new Label();
label.StyleClass.Add("BarL"); // Works if this line is commented out.
label.Text = "C";
C.Children.Add(label);
}
}
The StyleClass "BarL" is defined in an inline in the XAML page. So, why doesn't the code-behind know about it?