In silverlight, I'm creating a listbox at runtime. The listbox displays on the page okay but the items aren't selectable - I don't understand why? Am I doing something wrong? Here's my code:
C#
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
ListBox lb = GetListbox();
LayoutRoot.Children.Add(lb);
}
private ListBox GetListbox()
{
ListBox lb = new ListBox();
lb.Items.Add("Option 1");
lb.Items.Add("Option 1");
return lb;
}
}
VB
Partial Public Class MainPage
Inherits UserControl
Public Sub New()
InitializeComponent()
Dim lb As ListBox = GetListbox()
LayoutRoot.Children.Add(lb)
End Sub
Private Function GetListbox() As ListBox
Dim lb As New ListBox
lb.Items.Add("Option 1")
lb.Items.Add("Option 1")
Return lb
End Function
End Class