WPF Databinding combobox to a list

前端 未结 3 1247
温柔的废话
温柔的废话 2021-02-19 08:18

I am having a difficult time trying to bind my property which is of type List to my combobox through XAML.

public List MyProperty  { get; set; }
         


        
3条回答
  •  迷失自我
    2021-02-19 08:45

    Assume you have a List called Foos in your window / page. Foo has a property Name. Now you set up the binding in XAML as follows:

    
    

    This is based on this SO question. Read this (WPF DataBinding overview) as a good foundation for databinding in WPF.

提交回复
热议问题