---
title: "Discussion on \"Platform-specific XAML in .NET MAUI\" | Hashnode"
description: "Discussion on \"Platform-specific XAML in .NET MAUI\". Learn the magic of custom XAML across Platforms & Devices"
url: "https://hashnode.com/posts/platform-specific-xaml-in-net-maui/653648cf27cbfb771f1ce248"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Platform-specific XAML in .NET MAUI](https://blog.ewers-peters.de/platform-specific-xaml-in-net-maui?utm_source=hashnode&utm_medium=feed)

Learn the magic of custom XAML across Platforms & Devices

Oct 23, 2023 · 5 min read · blog.ewers-peters.de  
Read the article

-   [#dotnet-maui](https://hashnode.com/tag/dotnet-maui)
-   [#cross-platform](https://hashnode.com/tag/cross-platform)
-   [#xaml](https://hashnode.com/tag/xaml)
-   [#user-experience](https://hashnode.com/tag/user-experience)
-   [#mobile-development](https://hashnode.com/tag/mobile-development)

## Written by

[Julian Ewers-Peters](https://hashnode.com/@ewerspej)

@ewerspej · Germany

  
[View profile](https://hashnode.com/@ewerspej)

Mobile App Developer

I am a passionate mobile app and software developer with a focus on C# .NET, Xamarin.Forms and .NET MAUI.

## Responses

Markdown supported · ⌘↵ to post

[Mohamed Noordin](https://hashnode.com/@MohamedNoordin)

[Oct 28, 2023](https://hashnode.com/posts/platform-specific-xaml-in-net-maui/653648cf27cbfb771f1ce248/comment/653d532e8bb1c48f931a2794)

Actually, the View control can't be used as a base class for the return type (I'm not sure why), but we have to use another View-derived control like a Grid or any layout. Also, the above use of the <OnIdiom> markup is invalid. This markup does not use the <On> tag, nor Idiom attribute like what <OnPlatform> does. It should be like:

<OnIdiom x:TypeArguments="Grid"> <OnIdiom.Desktop> <views:DesktopView /> </OnIdiom.Desktop> <OnIdiom.Phone> <views:MobileView /> </OnIdiom.Phone> </OnIdiom> May I ask Microsoft, where is constancy? You can also use these markups in a short-handed way:

<Grid BackgroundColor="{OnIdiom Desktop=AliceBlue, Phone=Aqua}"/> Thanks for the great work! Hashnode first experience to create an account is a matter of time-waste though.

[Julian Ewers-Peters](https://hashnode.com/@ewerspej)

[Feb 17, 2024](https://hashnode.com/posts/platform-specific-xaml-in-net-maui/653648cf27cbfb771f1ce248/comment/653d532e8bb1c48f931a2794#reply-65d0693b0dbcb6e7f2a36400)

Not sure what you mean.
