MVVM datagrid binding

前端 未结 5 1593
深忆病人
深忆病人 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:23

    Sayed Saad above is correct. I see two potential problems with your setup, both of which Sayed resolves.

    1. The example posted in the question doen not implement INotifyPropertyChanged
    2. The CLR property being bound to must be a PUBLIC PROPERTY. Fields will not work, as databindindg works via reflection.

提交回复
热议问题