Currently I have my datagrid pulling and assigning data to each columns separately. Lets say I have 4 columns, I want to be able to have the data in column 1 equal column 1 and column 2 stacked.
MainPage.xmal
<Page.DataContext>
<local:vmCustomers />
</Page.DataContext>
<Grid:SfDataGrid x:Name="dgCustomers"
AutoGenerateColumns="False"
ScrollViewer.HorizontalScrollMode="Auto"
ScrollViewer.VerticalScrollMode="Auto"
NavigationMode="Row"
ItemsSource="{Binding Customers}" Margin="0,137,0,0">
<Grid:SfDataGrid.Columns>
<Grid:GridTextColumn ColumnSizer="SizeToHeader" HeaderText="Customer Number" MappingName="custNumber" />
<Grid:GridTextColumn ColumnSizer="SizeToCells" TextWrapping="NoWrap" HeaderText="Customer Name" MappingName="custName" />
<Grid:GridTextColumn ColumnSizer="SizeToCells" TextWrapping="NoWrap" HeaderText="Address" MappingName="custAdd1" />
<Grid:GridTextColumn ColumnSizer="SizeToCells" TextWrapping="NoWrap" HeaderText="Address 1" MappingName="custAdd2" />
</Grid:SfDataGrid.Columns>
</Grid:SfDataGrid>
vmCustomers.cs
public class vmCustomers
{
private ObservableCollection<dmCust> _customers;
public ObservableCollection<dmCust> Customers
{
get { return _customers; }
set { _customers = value; }
}
public string TMNumber { get; private set; }
public vmCustomers()
{
_customers = new ObservableCollection<dmCust>();
this.GenerateOrders();
}
private async void GenerateOrders()
{
var path = Path.Combine(Windows.Storage.ApplicationData.Current.LocalFolder.Path, "cust.db");
using (SQLite.Net.SQLiteConnection conn = new SQLite.Net.SQLiteConnection(new SQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), path))
{
var custQry = from p in conn.Table<cust>()
where p.CMRP1 == DataClass.tmNumber
select new
{
CustomerID = p.ID,
CustomerNumber = p.CMCSNO,
CustomerName = p.CMCSNM,
CustomerAddress = p.CMCAD1,
CustomerAddress2 = p.CMCAD2,
};
try
{
foreach (var d in custQry)
{
_customers.Add(new dmCust(d.CustomerID, d.CustomerNumber, d.CustomerName, d.CustomerAddress, d.CustomerAddress2, ));
int cnt = 0;
cnt++;
System.Diagnostics.Debug.WriteLine(cnt);
}
}
catch
{
var dialog = new MessageDialog("You must perform a database sync");
await dialog.ShowAsync();
}
}
}
}