Category / Section
How to make a switch column read-only in SfDataGrid?
1 min read
At present, SfDataGrid does not provide implicit support for making a GridSwitchColumn read-only. However you can achieve this requirement by loading a Xamarin.Forms.Switch inside a GridTemplateColumn and setting the IsEnabled property of the switch to be false.
<sfgrid:GridTemplateColumn MappingName="IsClosed" HeaderText="Is Closed" > <sfgrid:GridTemplateColumn.CellTemplate> <DataTemplate> <Switch IsEnabled="False" IsToggled="IsClosed"/> </DataTemplate> </sfgrid:GridTemplateColumn.CellTemplate> </sfgrid:GridTemplateColumn>
Screenshot
Sample Link
How to make a switch column read only and not be clickable in SfDataGrid?