I have a XamDataGrid, which I'm trying to bind to a BindingList collection object.

When I set AutoGenerateColumns to true,

it shows all the rows and columns,

but when I set it to false and define columns using Field or UnboundField, It just shows blank rows.

I'm sure, I'm binidng each column to the correct field name inside the BindingList object.

I'm using WPF MVVM architecture!

Wondering, if someone faced simillar issue before?

有帮助吗?

解决方案

Make sure that objects in your binding list have public properties with getters.

eg.

private string name;

public string Name
{
   get { return name; }
}

If you are updating the objects make sure you implement INotifyPropertyChanged and fire the event in your setters.

Also I would recommend using ObservableCollection<T> instead.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top