Nov 07 2021 11:36 PM
I am using the transition from Xamarin forms to Maui as an excuse to start using Shell as well.
Since Shell has been in the Maui previews for a long time now, I thought it would be easy to get started. But the template does not have Shell as an option, and for some reason I haven't been able to find an example project despite extensive search.
Can anyone point me to a simple example of a Maui Shell 'Hello World' app?
Nov 08 2021 12:00 AM
The Shell feature has been completed recently for .NET MAUI. I think the templates have to catch up to that. That is probably also the reason why there isn't a lot of content for it yet.
However, the API will be exactly the same between Xamarin.Forms and .NET MAUI. You should be able to learn about Shell in Forms and apply that to .NET MAUI. If you really want to do it in .NET MAUI right now, you might want to create a Forms one and see if you can convert that to .NET MAUI. Then you have also learned how to do that 😄
I get that it's not ideal right now, I hope the templates that you can use for this will be there soon.
Nov 08 2021 01:06 AM
Hi Gerald,
Thank you for the quick response.
I should add that I have done a little development in Shell in other Xamarin Forms apps. So I think/hope I got the API part covered.
The problem is overriding 'CreateWindow' in app.xaml.cs
I get a 'Return type must be Window..' and I cannot seem to get around that problem. Hence the request for a Hello World sample.
And converting a Forms project to Maui I end up in the same situation 🙂
Nov 08 2021 02:38 AM
SolutionNov 08 2021 03:38 AM
Mar 09 2022 05:10 PM
I am using the sample and added an image to the flyout header:
<Shell.FlyoutHeader>
<Grid BackgroundColor="{DynamicResource WindowBackgroundColor}"
HeightRequest="150"
Padding="0, 10">
<Image Source="dotnet_bot.png"
HorizontalOptions="Center"
VerticalOptions="Center"
HeightRequest="130"
WidthRequest="180"/>
</Grid>
</Shell.FlyoutHeader>
It works in Android but the image does not display in Windows, what am I missing? The image is in the "resources\images\" folder dotnet_bot.svg ... as you know MAUI will generate the dotnet_bot.png, but in Windows it looks like the publish folder is different. What do I need to do, so it works in both platforms? Thanks in advance.
Mar 09 2022 11:19 PM
@Juan Montoya Check for the presence of this attribute windows:Application.ImageDirectory="Assets" in the App.xaml file.
This has been deprecated in Preview 13 Changes, hence needs to be removed.
The sample in GitHub is reflecting the change while it is updated for Preview 13.
Mar 15 2022 05:10 PM
Jun 22 2022 12:03 PM
Nov 08 2021 02:38 AM
Solution