Results 1 to 2 of 2

Thread: populate combobox

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2007
    Posts
    694

    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.

  2. #2
    Hyperactive Member Arrow_Raider's Avatar
    Join Date
    Dec 2001
    Location
    AVR Lovers Club
    Posts
    423

    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
  •  



Click Here to Expand Forum to Full Width