Hi
I want to create a listbox(drop down) with list items in it.When user wants to select the item from listbox he should be able to scroll down or scroll up within the listbox.
SO i have the following xaml for it..
<ListBox Height="100" HorizontalAlignment="Left" Margin="101,63,0,0" Name="listBox1" VerticalAlignment="Top" Width="349">
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel Orientation="Vertical">
<TextBlock Text=" {Binding dtDate}">
</TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
And i have the following C# code.
public MainPage()
{
InitializeComponent();
FillListBox();
}
private void FillListBox()
{
List<string> dtday = new List<string>();
Console.WriteLine("\nCapacity: {0}", dtday.Capacity);
dtday.Add("1");
dtday.Add("2");
dtday.Add("3");
dtday.Add("4");
dtday.Add("5");
listBox1.ItemsSource = dtday;
}
But when i ran the program it always shows the text as {Binding dtDate}" not the values (1,2,3,4) i have written in the C# code.
Any help would be greatly appreciated..

Reply With Quote

