public partial class App : Application
{
protected override void OnStartup(StartupEventArgs e)
{
// Customers table (dataset is 'dsCustomers' as found in the ...Designer.cs file)
m_customer = new dsCustomers.TblCustomers();
//Create data adapter and fill from the source table
(new dsCustomersTableAdapters.TblCustomersTableAdapter()).Fill(m_customer );
m_customer.Rows.Add(m_customer.NewRow()); // Add a blank row
// Likewise for Address table (more verbose)
m_Addresses= new dsCustomers.TblAddresses();
dsCustomersTableAdapters.TblAddressesTableAdapter tblAdap = new dsCustomersTableAdapters.TblAddressesTableAdapter();
tblAdap.Fill(m_Addresses);
DataRow dr = m_Addresses.NewRow(); // generate a new row
m_Addresses.Rows.Add(dr); // append back to the table
base.OnStartup(e);
}
private dsCustomers.TblCustomers m_customer ;
public dsCustomers.TblCustomers Customers
{
get
{
return m_customer ;
}
}
private dsCustomers.TblAddresses m_Addresses;
public dsCustomers.TblAddresses Addresses
{
get
{
return m_Addresses;
}
}
}
Meanwhile the xaml is ..
< Grid.Resources>
< xcdg:DataGridCollectionViewSource
x:Key="Tblmycustomers"
Source="{Binding Source={x:Static Application.Current},
Path= Customers}"/ >
< xcdg:DataGridCollectionViewSource
x:Key="TblLocations"
AutoCreateForeignKeyDescriptions="true"
Source="{Binding Source={x:Static Application.Current},
Path= Addresses}"/ >
< /Grid.Resources >
No comments:
Post a Comment