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

CheckBox in sfdatagrid

I was set selection in sfdatagrid for whole row, and wanted to style the checked boxes in column by they still grayed out, i tried style triggers with property "isEnable" but the application was broken, how can i style CheckBox is this situation?

7 Replies

VS Vijayarasan Sivanandham Syncfusion Team January 15, 2020 10:10 AM UTC

Hi Aboubaker,  
Thank you for contacting Syncfusion support.  
Based on the provided information, your requirement of styling checkbox can be achieved using the CellStyle property. Please refer the following code example for the same, 
Code snippet:   
<syncfusion:GridCheckBoxColumn AllowEditing="True" HeaderText="Closed" MappingName="IsClosed" > 
   <syncfusion:GridCheckBoxColumn.CellStyle> 
      <Style TargetType="syncfusion:GridCell" > 
         <Style.Resources> 
            <Style TargetType="CheckBox"> 
               <Style.Triggers> 
                 <DataTrigger Binding="{Binding IsClosed}" Value="True"> 
                      <Setter Property="BorderBrush" Value="Red"/> 
                 </DataTrigger> 
               </Style.Triggers> 
            </Style> 
         </Style.Resources> 
      </Style> 
  </syncfusion:GridCheckBoxColumn.CellStyle> 
</syncfusion:GridCheckBoxColumn>
  
We have prepared sample based on your requirement, please find the sample by the following link. 
We hope this helps. Please let us know, if need any further assistance. 
Regards, 
Vijayarasan 



AB Aboubaker January 15, 2020 02:19 PM UTC

Hi Vijayarasan , in your example you gave me an editable dataGrid so the checkBox already enabled by default,

in my project I set AllowEditing="False" so the user cannot edit in DataGrid directly, but in a new child window.

In this case the checkbox is always disabled even if it's selected or not, so how can I design the checkbox in this situation?

and thank you so much by the way for your immediate helping.


FP Farjana Parveen Ayubb Syncfusion Team January 17, 2020 12:34 PM UTC

Hi Aboubaker, 
 
Thank you for your update. 
 
We have analyzed your query, and we can able to reproduce your reported scenario on our end. But that is the default behavior for CheckBox, we can’t able to apply the style for CheckBox in Disabled state. We have used the Framework CheckBox in GridCheckBoxColumn of SfDataGrid.  
 
Regards, 
Farjana Parveen A 



AB Aboubaker January 17, 2020 04:23 PM UTC

Ok Farjana, thank you so much for your support


FP Farjana Parveen Ayubb Syncfusion Team January 20, 2020 05:41 AM UTC

Hi Aboubaker, 
 
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. 
 
Regards, 
Farjana Parveen A 



AB Aboubaker January 23, 2020 09:42 AM UTC

Hi Farjana  actually I didn't resolve it, but it's not a big problem.


FP Farjana Parveen Ayubb Syncfusion Team January 24, 2020 05:56 AM UTC

Hi Aboubaker, 
 
Thank you for your update. Please let us know whether you require further other assistance from us. 
Regards, 
Farjana Parveen A 


Loader.
Live Chat Icon For mobile
Up arrow icon