Articles in this section
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

C:\Users\pavithra.sivakumar\AppData\Local\Microsoft\Windows\INetCacheContent.Word\Screenshot_2017-01-20-12-02-27.png

 

 

Sample Link

How to make a switch column read only and not be clickable in SfDataGrid?

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Please sign in to leave a comment
Access denied
Access denied