Different design in maui
Hello, I am developing a cross-platform program using MAUI. By the way, I want to apply a different design for each mobile/desktop, what should I do?
8 Replies
Two ways you can do this
1. Conditional Compilation (easy but expect lotta boilerplate)
2. Xaml approach (a bit tedious but much cleaner)
for no.1 you can do this
simple, but as said, full of boilerplate codes
...
for xaml approach :
I say, do the xaml one
Thanks very much!
goodluck
(how can I close this?)
maybe, the bot automaticly close this
But just to ask you one more question, where should I insert that XAML code?
well, in your xaml obviously 😄
see the introduction for .net Maui, it covers all things you want to know about xaml in maui
ok thanks
np
Hello friends, I need help, this is my code in .NET MAUI, and I want the application to start if there is a Token saved in SecureStorage, because when starting the application it does not load, that is, the startup code does not reach that line of code that says "Choose()", so you can choose whether to load with the AppShell or the navigation
"Code"
public App()
{
InitializeComponent();
Choose();
}
public async void Choose()
{
string tok = SecureStorage.GetAsync("token").Result;
if (!string.IsNullOrEmpty(tok))
{
MainPage = new NavigationPage(new Home())
{
//FlyoutBackgroundColor = Color.FromHex("#D68900"),
BarBackground = Color.FromArgb("#FFB04B"),
BarTextColor = Color.FromRgb(255, 255, 255),
};
}
else
{
MainPage = new AppShell()
{
FlyoutBackgroundColor = Color.FromArgb("#D68900"),
//BarBackground = Color.FromHex("#FFB04B"),
// BarTextColor = Color.FromRgb(255, 255, 255),
};
}
}