Sven's profileWebSmitSpacePhotosBlogListsMore ![]() | Help |
|
|
May 04 WPF: Bind Infragistics xamDataGrid to DataSet using Oracle.DataAccessRecently, I tried the first steps with Avalon (WPF). Since I used already the great Infragistics NetAdvantage toolset, I liked to test their new UI Suite "NetAdvantage for WPF" v2007.1. While Data Binding in .NET 3.0 changed, at first I wasn't very successful in binding a DataSet to the xamDataGrid. Finally, I came to the following conclusion:
public void Clicked(object sender, RoutedEventArgs e)
{
//some Code for opening Database-Connection
openOracleConnection();
OracleDataAdapter da = new OracleDataAdapter("SELECT * FROM myTable", myConn);
DataSet ds = new DataSet();
da.Fill(ds, "Table1");
DataTable table = ds.Tables["Table1"];
Binding bind = new Binding();
this.dataGrid1.DataContext = table;
bind.Source = table;
this.dataGrid1.SetBinding(Infragistics.Windows.DataPresenter.XamDataGrid.DataSourceProperty, bind);
}
See Result in attached Image. I'm using Expression Blend 1.0 and VS2005 with the .Net Framework 3.0 Tools for WPF Nov. 2006 CTP, DataAccess is done through ODP.NET 10g R2 (Oracle.DataAccess.dll). Have fun! |
|
|