Merk,
I would take a look into the BindingList<T> class in the
System.ComponentModel namespace. It should provide most of the
functionality that you are looking for.
If you want to modify your objects from code, and have the grid update,
then you should probably implement the INotifyPropertyChanged interface on
your class.
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
(E-Mail Removed)
"Merk" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I'm new to .NET (using 2.0) and was wondering how to go about binding a
> collection of custom classes to a DataGrid.
>
> The class exposes 5 read-only String properties. I would like for each of
> these properties to appear in a column in the DataGrid.
>
> The end result would be that when the collection has 35 objects in it, the
> DataGrid would have 35 rows and 5 columns (after being bound to the
> collection).
>
> Specifically -
> 1. which collection class could/should I use (or do I need to roll my own
> to make it "bindable")?
> and/or
> 2. how do I make my objects in that collection "bindable" to the
> DataGrid?
>
> Thanks.
>