Avuya Mxoli

Avuya Mxoli

  • NA
  • 236
  • 208.7k

Binding datagrid to datatable

May 2 2012 2:28 PM
Hi all,
I have been to many sites but I cannot find anything relating to my question. I am very new to WPF so pardon my question if it is too easy. I am trying to display data from a table that is in a database on a datagrid. I am using 3-tier architecture so my data access layer is a SQL server database that contains my stored procedures which I call from my Business layer and then I also have a presentation layer. On WPF  however, there is also xaml markup which I cannot understand. I have a datagrid on the xaml and I have the DataTable on the business layer which is populated using a stored procedure in my database. I don't know how to link these and when I type my dataGrid name on the business layer it does not show so I guess I have to call it from the presentation layer(.cs code)? but I tried that too and it gives me an error when I do something like grid.ItemsSource = bl.viewedProperty(). This is how I do it in a windows form app so I guess things are a little different with WPF.If anyone can please help me this is rather urgent. I saw something about itemsSource but I tried it and my grid still has no data. 

Thanks in advance. And just for interest sake I am using Visual Studio 2010.

Answers (1)