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 : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to add RadioButton columns in GridDataControl WPF

Thread ID:

Created:

Updated:

Platform:

Replies:

125656 Aug 31,2016 01:15 PM UTC Sep 3,2016 02:35 PM UTC WPF 3
loading
Tags: GridDataControl
Maheshwar Komalla
Asked On August 31, 2016 01:15 PM UTC

Hello,

I'm trying the add the RadioButton columns in WPF GridDataControl and couldn't succeed. Is this possible? If so could you please point me to the sample/example available online?
Here is the scenario: I have grid control with multiple columns and I want to add RadioButton for three columns A, B and C and want them mutual exclusive.

Thanks
Mahesh

Jai Ganesh S [Syncfusion]
Replied On September 1, 2016 12:55 PM UTC

Hi Mahesh, 
 
You can add the RadioButton inside the GridDataVisibleColumn’s CellItemTemplate like below, 
 
<syncfusion:GridDataVisibleColumn HeaderText="Checked" MappingName="IsChecked"> 
        <syncfusion:GridDataVisibleColumn.CellItemTemplate> 
                <DataTemplate> 
                    <RadioButton IsChecked="{Binding CellBoundValue}"/> 
                </DataTemplate> 
        </syncfusion:GridDataVisibleColumn.CellItemTemplate> 
        <syncfusion:GridDataVisibleColumn.CellEditItemTemplate> 
                <DataTemplate> 
                   <RadioButton IsChecked="{Binding CellBoundValue}"/> 
                </DataTemplate> 
        </syncfusion:GridDataVisibleColumn.CellEditItemTemplate> 
 </syncfusion:GridDataVisibleColumn> 
 
 
UG Link: 
 
We have a SfDataGrid control like GridDataControl. But compare to GridDataControl, SfDataGrid having a better performance and flexibility. SfDataGrid assists you to create entirely customizable and highly interactive features used to display and manipulate the huge amount of data. So, we suggest you to use SfDataGrid instead of GridDataControl.

You can also refer the below documentation link to know more about SfDatagrid, 
 
Regards, 
Jai Ganesh S 


Maheshwar Komalla
Replied On September 1, 2016 02:29 PM UTC

Thank you for the response. The question was if I have the two or more columns of RadioButton how would I make these columns mutual exclusive for each row?
I have attached the sample program where Columns A, B and C should be mutual exclusive for each row.
Appreciate your help!

Thanks
Mahesh

Attachment: RadioButtonPGSample_090116_e04b52ed.zip

Jai Ganesh S [Syncfusion]
Replied On September 3, 2016 02:35 PM UTC

Hi Mahesh, 
 
Your requirement can be achieved by using GroupName property of RadioButton. We have prepared a sample for this requirement using SfDataGrid and the sample can be downloaded from the below location, 
                    
<syncfusion:GridTemplateColumn MappingName="A" syncfusion:FocusManagerHelper.WantsKeyInput="True"> 
                    <syncfusion:GridTemplateColumn.CellTemplate> 
                        <DataTemplate> 
                            <RadioButton syncfusion:FocusManagerHelper.FocusedElement="True"  IsChecked="{Binding A, UpdateSourceTrigger=PropertyChanged}"  
                                         GroupName="{Binding ID}" syncfusion:VisualContainer.WantsMouseInput="True" 
                                         Background="LightBlue" HorizontalAlignment="Center"/> 
                        </DataTemplate> 
                    </syncfusion:GridTemplateColumn.CellTemplate> 
</syncfusion:GridTemplateColumn> 
 
 
Regards, 
Jai Ganesh S 


CONFIRMATION

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.

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

;