How come my databinding is writing out the Length property?

前端 未结 2 416
野趣味
野趣味 2021-01-27 04:15

So I\'ve setup a viewmodel to where it binds an ObservableCollection to my DataGrid.

It prints out the value just fine but it also prints out

相关标签:
2条回答
  • 2021-01-27 04:49

    DataGrid has property AutoGenerateColumns which is set to True by default and makes DataGrid to create a column for each property defined in items.

    DataGrid is bound to NewList which contains items of type string which has Length property. So it makes Length column

    you can disable auto-generation by setting <DataGrid AutoGenerateColumns="False" ...

    0 讨论(0)
  • 2021-01-27 04:54

    I forgot to add the property AutoGenerateColumns="False". Not sure why it was set to true by default or why it woudl choose the length property of all the properties but I guess I got it fixed.

    0 讨论(0)
提交回复
热议问题