0

Here is my problem: I have 2 classes

 public class UserProfile 
{
    public int UserId { get; set; }
    public string UserName { get; set; }

    public string Email { get; set; }


    public string Password { get; set; }
    public string PasswordSalt { get; set; }

    public string ConfirmPassword { get; set; }

    public byte[] Photo { get; set; }

    public string Location { get; set; }

    public string FirstName { get; set; }

    public string LastName { get; set; }

    public virtual University University { get; set; }
    public int UniversityId { get; set; }

}

and

 public class University 
{
    public int UniversityId { get; set; }

    public string NameUniversity { get; set; }

    public string MailUniversity { get; set; }

    public string AddressUniversity { get; set; }

    public string Location { get; set; }

    public virtual ICollection<UserProfile> Users { get; set; }
}

For registration (to add information on dabatabse) I wanna display the universities list in a combobox to allow the user to choose his university, but I don't know how to do the binding in a combobox (XAML and code behind).

Does anyone have an idea please? Thank you

1 Answers1

0
<Grid>
  <StackPanel>
    <Button Click="Button_Click">asdf</Button>
    <ComboBox ItemsSource="{Binding Path=PhonebookEntries}"
              DisplayMemberPath="Name"
              SelectedValuePath="Name"
              SelectedValue="{Binding Path=PhonebookEntry}" />
</StackPanel></Grid>

Binding WPF ComboBox to a Custom List.It is well explained

Community
  • 1
  • 1
Ibrahim
  • 949
  • 3
  • 12
  • 21