We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Stacking data in columns

Thread ID:





124064 May 12,2016 10:54 AM May 12,2016 11:36 PM UWP 3
Tags: SfDataGrid
Garling Beard
Asked On May 12, 2016 10:54 AM

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. 

        <local:vmCustomers />

<Grid:SfDataGrid x:Name="dgCustomers"
                           ItemsSource="{Binding Customers}" Margin="0,137,0,0">
                <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" />                


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>();

        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,
                    foreach (var d in custQry)
                        _customers.Add(new dmCust(d.CustomerID, d.CustomerNumber, d.CustomerName, d.CustomerAddress, d.CustomerAddress2, ));
                        int cnt = 0;
                    var dialog = new MessageDialog("You must perform a database sync");
                    await dialog.ShowAsync();



Sivakumar R [Syncfusion]
Replied On May 12, 2016 12:04 PM

Hi Garling, 
Your requirement can be achieved using GridTemplateColumn or GridColumn.CellTemplate. Please find the UG link for the same, 
You can change the row height also if needed. Please find the documentation link below, 
Please let us know if you have any queries. 

Garling Beard
Replied On May 12, 2016 03:31 PM

Thank you, that was what I needed. 

Srinivasan Vasu [Syncfusion]
Replied On May 12, 2016 11:36 PM

Hi Garling, 
Thanks for your update. 


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.