How to restrict the orientation change from sample level for Android and iOS platforms in SfDataGrid ?
In this article, we will show you how to restrict the orientation change from sample level for Android and iOS in .Net Maui DataGrid.
The code below demonstrates how to restrict orientation changes at the sample level on the Android platform. The following code needs to be added to the MainActivity.cs file located under Platforms -> Android -> MainActivity.cs.
public class MainActivity : MauiAppCompatActivity
{
protected override void OnCreate(Bundle? savedInstanceState)
{
base.OnCreate(savedInstanceState);
RequestedOrientation = ScreenOrientation.Portrait;
}
}
For iOS, you can define the allowed orientations in the Info.plist. You can find the Info.Plist file loacted under platform -> iOS -> Info.Plist.
Take a moment to explore this documentation, where you can find more information about Syncfusion .NET MAUI DataGrid (SfDataGrid) with code examples. Please refer to this link to learn about the essential features of Syncfusion .NET MAUI DataGrid (SfDataGrid).
I hope you enjoyed learning about how to restrict the orientation change from sample level for Android and iOS platforms in .NET MAUI DataGrid (SfDataGrid).
You can refer to our .NET MAUI DataGrid’s feature tour page to learn about its other groundbreaking feature representations. You can also explore our .NET MAUI DataGrid Documentation to understand how to present and manipulate data. For current customers, you can check out our .NET MAUI components on the License and Downloads page. If you are new to Syncfusion, you can try our 30-day free trial to explore our .NET MAUI DataGrid and other .NET MAUI components.
If you have any queries or require clarifications, please let us know in the comments below. You can also contact us through our support forums, Direct-Trac or feedback portal, or the feedback portal. We are always happy to assist you!