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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Adding different types in the same column in Sfdatagrid

Thread ID:





124665 Jun 21,2016 01:18 PM UTC Jun 22,2016 01:52 PM UTC UWP 1
Tags: SfDataGrid
Aayush Gupta
Asked On June 21, 2016 01:18 PM UTC

How can add different types in the same column in SfDataGrid? For example, I want to have both comboboxes and normal textblocks in a single column. Is there any way to do that? Thanks in advance.

Jai Ganesh S [Syncfusion]
Replied On June 22, 2016 01:52 PM UTC

Hi Aayush, 
You can achieve your requirement to load the different types in same column by using CellTemplateSelector like below, 
    <DataTemplate x:Key="CellTemplate1"> 
            <ComboBox Grid.Column="0" Height="35" Width="165"> 
    <DataTemplate x:Key="CellTemplate2"> 
        <TextBlock Foreground="DarkRed" Text="{Binding Path=Value}" /> 
<syncfusion:GridTemplateColumn MappingName="UserId" Width="300" SetCellBoundValue="True"  CellTemplateSelector="{StaticResource selector}"> 
public class EditTemplateSelector : DataTemplateSelector 
        protected override DataTemplate SelectTemplateCore(object item, DependencyObject container) 
            if (item != null) 
                var data = (item as DataContextHelper).Record as UserInfo; 
                if (data.UserId < 1015) 
                    return Application.Current.Resources["CellTemplate1"] as DataTemplate; 
                    return Application.Current.Resources["CellTemplate2"] as DataTemplate; 
            return base.SelectTemplateCore(item, container); 
Jai Ganesh S 


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.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon 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.Close Icon