Articles in this section
Category / Section

How to align Xamarin.iOS DataGrid in the center of its parent?

2 mins read

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:

C:\Users\suhasini.suresh\AppData\Local\Microsoft\Windows\INetCacheContent.Word\Simulator Screen Shot 31-Jan-2017, 2.07.59 PM.PNG

 

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 forumsDirect-Trac, or feedback portal. We are always happy to assist you!

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