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

How to disable edit GridCheckBoxColumn cell?

Hi,
But this doesn't work for GridCheckBoxColumn (CurrentCellBeginEdit is not fired). Is there a way how to implement it for this column type?

Thanks
Ondra Svoboda

1 Reply

JP Jagadeesan Pichaimuthu Syncfusion Team June 19, 2019 11:03 AM UTC

Hi Ondrej, 
  
Thank you for using Syncfusion controls. 
  
By default, editing related events is not triggered for GridCheckBoxColumn in SfDataGrid, so you can achieve your requirement “Disable editing cells and change their background color” by using converter in GridTemplateColumn with CheckBox. 
  
Please refer the below code example 
<syncfusion:GridTemplateColumn MappingName="Conformed"> 
    <syncfusion:GridTemplateColumn.CellTemplate> 
        <DataTemplate> 
            <CheckBox IsChecked="{Binding Conformed}"  
                      IsEnabled="{Binding Conformed, Converter={StaticResourcecheckBoxConverter}}" /> 
        </DataTemplate> 
    </syncfusion:GridTemplateColumn.CellTemplate> 
    <syncfusion:GridTemplateColumn.CellStyle> 
        <Style TargetType="syncfusion:GridCell"> 
            <Setter Property="Background" Value="{Binding Conformed, Converter = {StaticResource cellbackgroundconverter}}" /> 
        </Style> 
    </syncfusion:GridTemplateColumn.CellStyle> 
</syncfusion:GridTemplateColumn> 
  
public class CheckBoxConverter : IValueConverter 
{ 
    public object Convert(object value, Type targetType, object parameter,CultureInfo culture) 
    { 
        if (value == null) 
            return false; 
        return true; 
    } 
  
    public object ConvertBack(object value, Type targetType, object parameter,CultureInfo culture) 
    { 
        throw new NotImplementedException(); 
    } 
} 
 
 
Let us know whether this helps also if you need any further assistance on this. 
  
Regards, 
Jagadeesan 
 


Loader.
Live Chat Icon For mobile
Up arrow icon