Articles in this section
Category / Section

How to apply animation for the selected rows in Xamarin.Forms DataGrid?

4 mins read

SfDataGrid provides support to select one or more rows either programmatically or by touch interactions. By default SfDataGrid does not apply any animation for the selected rows. However it provides extensibility to apply animation for the selected rows by writing a custom SelectionController derived from GridSelectionController and assigning it to the SfDataGrid.SelectionController property. You can override the SetSelectionAnimation () method in which you will get the selected row element as an argument. Thus you can apply animation for the selected row(s) in runtime based on your requirement.

Refer the following code example that explains how to apply a simple Alpha animation to the selected row.

dataGrid.SelectionController = new CustomSelectionController(dataGrid);
dataGrid.SelectionMode = SelectionMode.Multiple;


public class CustomSelectionController : GridSelectionController
    public CustomSelectionController(SfDataGrid dataGrid)
        this.SelectedRows = new GridSelectedRowsCollection();
        this.DataGrid = dataGrid;
    protected override void SetSelectionAnimation(VirtualizingCellsControl rowElement)
        rowElement.Opacity = 0;
        rowElement.FadeTo(1, 2000, Easing.CubicInOut);


Refer the following screenshot that shows the final outcome upon execution of the above code.


Sample Link:


I hope you enjoyed learning about how to apply animation for the selected rows in Xamarin.Forms DataGrid.

You can refer to our Xamarin.Forms DataGrid feature tour page to know about its other groundbreaking feature representations. You can also explore our Xamarin.Forms Chart documentation to understand how to create and manipulate data.

For current customers, you can check out our components from the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to check out our other controls.

If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forumsDirect-Trac, or feedback portal. We are always happy to assist you!

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