Articles in this section
Category / Section

How to bind button command to ViewModel from TemplateColumn of DataGrid?

1 min read

You can bind command property of button inside GridTemplateColumn to a property in ViewModel, by binding command with source as SfDataGrid BindingContext using x:Reference. Refer the below code example for more details.



<sfgrid:GridTemplateColumn  MappingName="ShipCountry" >
            <Button WidthRequest="100" Text="Delete" 
                      Command="{Binding Source={x:Reference dataGrid}, Path=BindingContext.DeleteRecordCommand}"
                      CommandParameter="{Binding .}" />



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