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

(URGENT) DataGridCheckBoxColumn inside Syncfusion Grid

Hi,

I was using DataGrid in my project, recently which has been replaced with syncfusion grid. There was a checkbox column inside DataGrid which I was using to bind the IsChecked property.

And on the check/uncheck of checkbox, a button (outside the grid) gets enabled/disabled.

I have used below code to accomplish the task:

<syncfusion:GridDataVisibleColumn MappingName="IsChecked">
                    <syncfusion:GridDataVisibleColumn.CellItemTemplate>
                        <DataTemplate>
                            <CheckBox
                                             syncfusion:VisualContainer.WantsMouseInput="true"
                                             VerticalContentAlignment="Center">
                                <CheckBox.Content>
                                    <Binding Path="CellBoundValue"
                                                     Mode="TwoWay"
                                                     UpdateSourceTrigger="PropertyChanged">
                                    </Binding>
                                </CheckBox.Content>
                            </CheckBox>
                        </DataTemplate>
                    </syncfusion:GridDataVisibleColumn.CellItemTemplate>
                </syncfusion:GridDataVisibleColumn>

And here is the code which I was using in DataGrid to achieve the same functioanlity:

<DataGridCheckBoxColumn Binding="{Binding IsChecked, UpdateSourceTrigger=PropertyChanged, Mode=TwoWay}"/>

 

Please help me to get out of this problem. Do reply my ASAP.

Thanks,

Sunil Goel

 


1 Reply

SK S. Kannan Syncfusion Team May 25, 2012 10:06 AM UTC

Hi Sunil,

 

Thanks for you update.

 

You can achieve your requirement by using the below two ways.

 

Way 1: Using CheckBox CellType

 

You can use our inbuilt CheckBox cell type to achieve your requirement and the following is the XAML snippet to use the inbuilt Check Box  cellType.

 

Code Snippet [XAML]

 

 <syncfusion:GridDataVisibleColumn MappingName="IsChecked">
                <syncfusion:GridDataVisibleColumn.ColumnStyle>
                    <syncfusion:GridDataColumnStyle CellType="CheckBox"/>
                </syncfusion:GridDataVisibleColumn.ColumnStyle>
            </syncfusion:GridDataVisibleColumn>

 

 

Way 2: Using Data Template CellType

 

You can also use Data Template cell type to achieve your requirement and the following is the XAML snippet to use the Data Template Cell Type.

 

Code Snippet [XAML]

 

<syncfusion:GridDataVisibleColumn MappingName="IsChecked">
       <syncfusion:GridDataVisibleColumn.CellItemTemplate>
            <DataTemplate>
                 <CheckBox syncfusion:VisualContainer.WantsMouseInput="true" IsChecked="{Binding CellBoundValue, Mode=TwoWay}"
                                  VerticalContentAlignment="Center"/>
            </DataTemplate>
       </syncfusion:GridDataVisibleColumn.CellItemTemplate>
</syncfusion:GridDataVisibleColumn>
 

 

Please let us know if you have any queries.

 

Regards,

Kannan. S


Loader.
Live Chat Icon For mobile
Up arrow icon