.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
0 comments No comments
{count} votes

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.