|
1 | | -# How-to-make-a-check-box-column-read-only-in-.NET-MAUI-DataGrid-SfDataGrid |
2 | | -This demo shows how to make a check box column read-only in .NET MAUI DataGrid (SfDataGrid)? |
| 1 | +# How to make a check box column read only in .NET MAUI DataGrid SfDataGrid |
| 2 | +Currently, [SfDataGrid](https://www.syncfusion.com/maui-controls/maui-datagrid) does not offer built-in support for setting a [DataGridCheckBoxColumn](https://help.syncfusion.com/cr/maui/Syncfusion.Maui.DataGrid.DataGridCheckBoxColumn.html) as read-only. However, you can fulfill this requirement by incorporating a CheckBox within a `DataGridTemplateColumn` and configuring the `IsEnabled` property of the CheckBox to be `false`. |
| 3 | + |
| 4 | +##### xaml: |
| 5 | + ```XML |
| 6 | +<syncfusion:SfDataGrid ItemsSource="{Binding Employees}" |
| 7 | + AutoGenerateColumnsMode="None" |
| 8 | + DefaultColumnWidth="155"> |
| 9 | + <syncfusion:SfDataGrid.Columns> |
| 10 | + <syncfusion:DataGridTemplateColumn MappingName="EmployeeStatus" |
| 11 | + HeaderText="Employee Status"> |
| 12 | + <syncfusion:DataGridTemplateColumn.CellTemplate> |
| 13 | + <DataTemplate> |
| 14 | + <CheckBox IsEnabled="False" |
| 15 | + HorizontalOptions="Center" |
| 16 | + IsChecked="{Binding EmployeeStatus}" /> |
| 17 | + </DataTemplate> |
| 18 | + </syncfusion:DataGridTemplateColumn.CellTemplate> |
| 19 | + </syncfusion:DataGridTemplateColumn> |
| 20 | + <syncfusion:DataGridTextColumn MappingName="EmployeeID" |
| 21 | + HeaderText="Employee ID" /> |
| 22 | + <syncfusion:DataGridTextColumn MappingName="Name" |
| 23 | + HeaderText="Name" /> |
| 24 | + <syncfusion:DataGridTextColumn MappingName="IDNumber" |
| 25 | + HeaderText="ID Number" /> |
| 26 | + </syncfusion:SfDataGrid.Columns> |
| 27 | + |
| 28 | +</syncfusion:SfDataGrid> |
| 29 | + ``` |
| 30 | + |
| 31 | +Executing the code example above yields the following output. |
| 32 | + |
| 33 | +<img src="checkBoxColumn.png" width="360"> |
| 34 | + |
| 35 | +[View sample in GitHub](https://github.com/SyncfusionExamples/How-to-make-a-check-box-column-read-only-in-.NET-MAUI-DataGrid-SfDataGrid/tree/master) |
| 36 | + |
| 37 | +Take a moment to explore this [documentation](https://help.syncfusion.com/maui/datagrid/overview), where you can find more information about Syncfusion .NET MAUI DataGrid (SfDataGrid) with code examples. Please refer to this [link](https://www.syncfusion.com/maui-controls/maui-datagrid) to learn about the essential features of Syncfusion .NET MAUI DataGrid (SfDataGrid). |
| 38 | + |
| 39 | +##### Conclusion |
| 40 | + |
| 41 | +I hope you enjoyed learning about how to make a check box column read-only in .NET MAUI DataGrid (SfDataGrid)? |
| 42 | + |
| 43 | +You can refer to our [.NET MAUI DataGrid’s feature tour](https://www.syncfusion.com/maui-controls/maui-datagrid) page to learn about its other groundbreaking feature representations. You can also explore our [.NET MAUI DataGrid Documentation](https://help.syncfusion.com/maui/datagrid/getting-started) to understand how to present and manipulate data. |
| 44 | +For current customers, you can check out our .NET MAUI components on the [License and Downloads](https://www.syncfusion.com/sales/teamlicense) page. If you are new to Syncfusion, you can try our 30-day [free trial](https://www.syncfusion.com/downloads/maui) to explore our .NET MAUI DataGrid and other .NET MAUI components. |
| 45 | + |
| 46 | +If you have any queries or require clarifications, please let us know in the comments below. You can also contact us through our [support forums](https://www.syncfusion.com/forums), [Direct-Trac](https://support.syncfusion.com/create) or [feedback portal](https://www.syncfusion.com/feedback/maui?control=sfdatagrid), or the feedback portal. We are always happy to assist you! |
| 47 | + |
0 commit comments