|
-
Jan 29th, 2011, 09:00 PM
#1
Thread Starter
Fanatic Member
populate combobox
I am currently populating a combobox as follows:
private void PopulateHealthLevels()
{
List<clsStudentDetails> healthlevels = new List<clsStudentDetails>();
healthlevels = clsStudentAccess.GetHealthLevels();
foreach (clsStudentDetails details in healthlevels)
{
cboHealth.Items.Add(details.HealthLevelName);
}
}
Question:
This is what I have in xaml:
Name="cboHealth" SelectedIndex="{Binding Path=HealthLevelID}"
The selectedindex does not seem to be working correctly.
No matter which student I choose, the item shown is always the same.
Note that there are items populated in th ecombobox.
Thanks
Last edited by arkiboys; Jan 29th, 2011 at 09:35 PM.
-
Jan 29th, 2011, 10:59 PM
#2
Hyperactive Member
Re: populate combobox
Use the SelectedItem property instead, and have it bound to an instance of an item in the list.
My monkey wearing the fedora points and laughs at you.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|