小编Vee*_*sss的帖子

wpf组合框结合

嗨,我正在尝试将List <>绑定到组合框.

<ComboBox Margin="131,242,275,33" x:Name="customer" Width="194" Height="25"/>

public OfferEditPage()
    {
        InitializeComponent();
        cusmo = new CustomerViewModel();
        DataContext = this;
        Cusco = cusmo.Customer.ToList<Customer>();
        customer.ItemsSource = Cusco;
        customer.DisplayMemberPath = "name";
        customer.SelectedValuePath = "customerID";
        customer.SelectedValue = "1";
    }
Run Code Online (Sandbox Code Playgroud)

我变得没有错误,但Combobox总是空的.库斯科是我的名单的财产.我不知道这段代码有什么问题.你能帮助我吗?

电贺

 public class Customer
{
    public int customerID { get; set; }
    public string name { get; set; }
    public string surname { get; set; }
    public string telnr { get; set; }
    public string email { get; set; }
    public string adress { get; …
Run Code Online (Sandbox Code Playgroud)

c# wpf binding combobox list

8
推荐指数
1
解决办法
4万
查看次数

标签 统计

binding ×1

c# ×1

combobox ×1

list ×1

wpf ×1