MVVM datagrid binding

前端 未结 5 1582
深忆病人
深忆病人 2020-12-10 16:33

I\'m using MVVM for my project and I\'m trying to bind a table from my database with a DataGrid. But when I run my application datagrid is empty.

MainWindow.

5条回答
  •  执笔经年
    2020-12-10 17:21

    Lecturers is a field, but data binding works with properties only. Try declaring Lecturers like:

    public ObservableCollection Lecturers { get; set; }
    

提交回复
热议问题