I figured out how to add list items from code behind. For some one who might have a similar problem, my solution is given below.
I created an observable collection
Code behind
int startyear 2000;
int endyear 2010;
ObservableCollection<string> yearlist = new ObservableCollection<string>();
for (int i = endyear; i >= startyear; i--)
{
yearlist.Add(i.ToString());
}
YearListPicker.ItemsSource = yearlist;
XAML
<toolkit:ListPicker Margin="4,4,4,4"
x:Name="YearListPicker" Header="Year" >
</toolkit:ListPicker>
Interesting article on ListPicker
No comments:
Post a Comment