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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Capture value in datatemplate assigned to checkbox column

Thread ID:





151269 Feb 5,2020 01:04 PM UTC Feb 7,2020 06:28 AM UTC WPF 3
Tags: SfDataGrid
Tech Shop
Asked On February 5, 2020 01:04 PM UTC

Hello, how are you?

I have a sfdatagrid that is shared by the whole application, in this scenario there may be cases of having more than one column of the chechbox type.

What I'm doing is assigning a template to these checkbox columns.

What I need is to take the value of this cell and then apply a converter and use icons.

In the documentation I saw an example, but the column name is passed there, but it doesn't work for my scenario, because I need this to be dynamic, as I will have several checkbox columns and with different names.

I also saw it on the internet saying to use {Binding CellBoundValue}, I tried it and was unsuccessful. If I use the column name it works, but then I will have to make a very large template with all the column name options. Totally unfeasible.

Attached are the images that will show how I am doing.

Attachment: TS_2941326.rar

Saravanan Ayyanar [Syncfusion]
Replied On February 6, 2020 01:35 PM UTC

Hi Tech Shop, 
Thank you for using Syncfusion controls. 
You can achieve your requirement of “Same template apply different column” by setting the Binding as Value and SetCellBoundValue as true. Please refer the below code snippet. 
<DataTemplate   x:Key="cellTemplate"> 
    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center"> 
        <Button Content="{Binding Path=Value,Converter={StaticResource converter}}" Width="70" Height="25" /> 
        <TextBlock  Foreground="Red" 
            Text="{Binding Path=Value, Converter={StaticResource converter}}"/> 
        <CheckBox IsChecked="{Binding Path=Value,Converter={StaticResource converter}}"/> 
     e.Column = new GridTemplateColumn() 
         MappingName = e.Column.MappingName, 
         CellTemplate = Application.Current.FindResource("cellTemplate") as DataTemplate 
Sample Link: 
UG Link: 
Please let us know, if you require further assistance on this. 
Saravanan A. 

Tech Shop
Replied On February 6, 2020 04:31 PM UTC

Hi Saravanan,

Worked perfectly. Thank you very much for your assistance.

Farjana Parveen Ayubb [Syncfusion]
Replied On February 7, 2020 06:28 AM UTC

Thanks for the update. 
We are glad to know that the reported problem has been resolved at your end. Please let us know if you have any further queries on this. We are happy to help you. 
Farjana Parveen A 


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

This page will automatically be redirected to the 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

Live Chat Icon For mobile
Live Chat Icon