How to align Xamarin.iOS DataGrid in the center of its parent?
The SfDataGrid can be aligned to the center of the parent, by giving appropriate “Frame” to it in the ViewDidLayoutSubviews() override method.
Refer the below code, in which ‘x’ and ‘y’ co-ordinates of the frame are given a value to get the SfDataGrid in the center of the parent.
View.AddSubview(dataGrid);
public override void ViewDidLayoutSubviews()
{
base.ViewDidLayoutSubviews();
int dataGridHeight = 400;
int dataGridWidth = 200;
dataGrid.Frame = new CoreGraphics.CGRect(View.Center.X - dataGridWidth / 2, View.Center.Y - dataGridHeight / 2, dataGridWidth, dataGridHeight);
}
Screenshot:
Sample Link:
How to align SfDataGrid in the center of its parent
Conclusion
I hope you enjoyed learning about how to align Xamarin.iOS DataGrid in the center of its parent.
You can refer to our Xamarin.iOS DataGrid feature tour page to know about its other groundbreaking feature representations. You can also explore our Xamarin.iOS DataGrid 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 forums, Direct-Trac, or feedback portal. We are always happy to assist you!