【问题标题】:Display data in Combobox (windows 8.1/XAML)在组合框中显示数据 (windows 8.1/XAML)
【发布时间】:2015-01-19 18:31:35
【问题描述】:

这是我的问题:我有 2 个课程

 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; }

}

 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; }
}

对于注册(在 dabatabse 上添加信息)我想在组合框中显示大学列表以允许用户选择他的大学,但我不知道如何在组合框中进行绑定(XAML 和代码隐藏) .

请问有人有意见吗? 谢谢

【问题讨论】:

    标签: c# xaml combobox windows-8.1


    【解决方案1】:
    <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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-09-10
      • 2016-08-04
      • 1970-01-01
      • 2012-01-22
      • 1970-01-01
      相关资源
      最近更新 更多