Check for Tablet in .NET Maui

Fritz Switzer 301 Reputation points
2024-05-25T01:08:28.11+00:00

In my .NET Maui application , I can check for Android or Windows and create View based on that check, however, I want to create views for Tablets that are different than Android Phone.

Here is my check so far.

 public partial class App : Application
    {
        public App()
        {
            InitializeComponent();
#if ANDROID || IOS
            MainPage = new NavigationPage(new MobileStartPage());
#else
            MainPage=new NavigationPage(new DesktopStartPage());
#endif
        }
    }

How can I check for a Tablet?


.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,622 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
11,037 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 66,941 Reputation points
    2024-05-25T16:35:04.18+00:00
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Roberto Patuelli 0 Reputation points
    2024-08-28T16:34:16.0933333+00:00

    You can use this platform independent MAUI code:

    if (DeviceInfo.Idiom==DeviceIdiom.Tablet)
    //DO SOMETHING
    
    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.