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

Firing event when GridDataColumnStyle CellType="CheckBox" is checked

Hi my question is the following:
you can use a Command when the checkbox is selected?
former code snippet: 

<syncfusion:GridDataVisibleColumn HeaderText="Graph Signal"
                                                          MappingName="Selected">

                            <syncfusion:GridDataVisibleColumn.ColumnStyle>

                                <syncfusion:GridDataColumnStyle CellType="CheckBox"
                                                                HorizontalAlignment="Center"
                                                                IsThreeState="False">

                                </syncfusion:GridDataColumnStyle>
                            </syncfusion:GridDataVisibleColumn.ColumnStyle>
                            <syncfusion:GridDataVisibleColumn.HeaderStyle>
                                <syncfusion:GridDataColumnStyle HorizontalAlignment="Center" />
                            </syncfusion:GridDataVisibleColumn.HeaderStyle> 
                          
                            <i:Interaction.Triggers>
                                <i:EventTrigger EventName="CheckBoxClick">
                                    <i:InvokeCommandAction Command="{Binding SelectedChannelCommand}" />
                                </i:EventTrigger>
                            </i:Interaction.Triggers>


                       </syncfusion:GridDataVisibleColumn>

I await your answers,
thank you.
Alessio Massimiliano

1 Reply

SM Saravanan M Syncfusion Team November 19, 2013 10:18 AM UTC

Hi Massi,

We are sorry for the delay

We have analyzed your query. If you want to handle checkbox clicked event,you have to hook the CurrentCellChanged event. You can refer the below codesnippet to achieve your requirement.

Codesnippet[C#]:

this.syncgrid.CurrentCellChanged += new Syncfusion.Windows.ComponentModel.GridRoutedEventHandler(syncgrid_CurrentCellChanged);

   void syncgrid_CurrentCellChanged(object sender, Syncfusion.Windows.ComponentModel.SyncfusionRoutedEventArgs args)

        {

            var currentcellmanager = this.syncgrid.Model.CurrencyManager;

            if (currentcellmanager.CurrentCell.HasCurrentCell)

            {

                var currentcell = currentcellmanager.CurrentCell;

                if (currentcell.Renderer is GridCellCheckboxRenderer)

                {

                    var value = currentcell.Renderer.ControlValue as bool?;

                    if ((bool)value)

                    {

                        MessageBox.Show("checkbox selected");

                    }

                    else

                    {

                        MessageBox.Show("checbox unselected");

                    }

                }

            }

        }

 

 

We have prepared sample based on your requirement and please find the attachment sample below.

Please let us know if you have any queries,

Regards,

Saravanan.M



GridDataControl_checkbox_Eventhandle_ff0ff7ce.zip

Loader.
Live Chat Icon For mobile
Up arrow icon