tags:

views:

43

answers:

2

Hi, I'm very new to WPF, and am trying to set the datasource (which the WPF Grid doesn't have as a property) of my grid to take a List. Does anyone have any code examples of how to do this. I have googled it, but can't find any really good examples.

(Oh, and can anyone suggest a good site for all round WPF Code examples?)

Thanks

+2  A: 

If you're referring to a WPF Grid, you can't bind it to data; it's meant for layout purposes only; you might want to look into one of the controls that inherit from ItemsControl, such as ListView.

The property you'd bind your list to, is called ItemsSource.

Gurdas Nijor
Do you have to call any other methods after setting the ListView ItemsSource property?
Ben
+1  A: 

The other control you might be thinking of is the GridView

There's also the DataGrid (Note old link) in the WPF Toolkit which implements a lot of the same functionality as the WinForms DataGridView

ChrisF