2X faster development
The ultimate Xamarin UI toolkit to boost your development speed.
You can perform the long press operations in SfDataGrid by hooking the SfDataGrid.GridLongPressed event. Refer the below code example in which the SfDataGrid is loaded and the GridLongPressed event is hooked. <ContentPage.BindingContext> <local:ViewModel x:Name="viewModel"/> </ContentPage.BindingContext> <ContentPage.Content> <syncfusion:SfDataGrid x:Name="datagrid" ColumnSizer="Star" AutoGenerateColumns="True" ItemsSource="{Binding OrdersInfo}" GridLongPressed="Datagrid_GridLongPressed"> </syncfusion:SfDataGrid> </ContentPage.Content>
The below code illustrates displaying a DisplayAlert to display the underlying data of the long pressing row. private void Datagrid_GridLongPressed(object sender, Syncfusion.SfDataGrid.XForms.GridLongPressedEventsArgs e) { //You can perform any operation here based on the requirements //Code to display a DisplayAlert showing the underlying data. string name = (e.RowData as StudentInfo).StudentName; string regNo = (e.RowData as StudentInfo).StudentRegno; DisplayAlert(name, "RegNO"+ regNo.ToString(), "Cancel"); }
Screenshot:
Sample Link: |
2X faster development
The ultimate Xamarin UI toolkit to boost your development speed.
This page will automatically be redirected to the sign-in page in 10 seconds.