.net Maui: use of 'ShellContent' to pass a parameter

Eduard Kaufmann 311 Reputation points
2025-07-21T15:02:59.9033333+00:00

Thank you in advance for your time and help

Is somewhere out there helping a pretty old hobby developer on .net maui

GIT: https://github.com/edikaufmann/RandoJson (public).

I'm still struggling to dynamically call the appropriate .json data based on:

In AppShell.xaml:

<ShellContent Title="VARHaute"

           ContentTemplate="{DataTemplate views:MainPage}"

           Route="varhaute"

           Style="{StaticResource VARHauteShell}" />

In RandoService.cs:

I call my .json data(today hard coded).

Target: to use the value in 'Route="varhaute"' to feed my 'string myurl =' dynamically.

.....

// how to set fileName dynamically ?????????????????????????????????

string myUrl = "varhaute";

// comment: file names are = "varhaute" or "sioublanc" or "alpesdehauteprovence"

var response = await httpClient.GetAsync("https://randopro.org/MyUploads/MyJson/" + myUrl + ".json");

.....

I'm (still) struggling to pass the value in 'route = "varhaute"' to RandoService.cs

Thank you

ed k

Developer technologies | XAML
Developer technologies | XAML
A language based on Extensible Markup Language (XML) that enables developers to specify a hierarchy of objects with a set of properties and logic.
{count} votes

Your answer

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