783 questions
105
votes
4
answers
52k
views
Basic concepts of MVVM-- what should a ViewModel do?
Trying to grasp the concepts of MVVM, I have already read several blogs and looked at a few projects.
From what I understand, a View is dumb, it just knows how to present something that is passed to ...
11
votes
5
answers
19k
views
How can I resolve a service that I registered with the builder.Services inside of a ViewModel?
Summary: I am hoping to use MAUI's builder.Services to resolve services in ViewModels, but I don't understand how to do so.
I could create my own IServiceProvider, but I am hoping to avoid the needed ...
5
votes
2
answers
2k
views
CollectionView working in debug but not in release in .NET MAUI
I have the following
<CollectionView Margin="5" ItemsSource="{Binding Subjects}">
<CollectionView.ItemsLayout>
<GridItemsLayout Orientation="...
15
votes
6
answers
37k
views
MAUI : Customize an Entry
I'm new to MAUI with basic knowledge on Xamarin.Forms
I would like to add a bottom border (and border tickness) to an Entry control in MAUI.
On Xamarin.Forms, we had to create a Custom Control and ...
8
votes
1
answer
4k
views
.Net MAUI data binding not carrying through to custom component
I am having trouble getting data binding to work with custom components.
I have created an IncrementValue property that gets incremented with every button click.
The changes are reflected when bound ...
41
votes
12
answers
40k
views
MAUI .NET Set Window Size
How can I set the window size in MAUI?
Background info: I only care about Windows for this application - I chose MAUI so I could use Blazor for a desktop application. For some reason the default ...
35
votes
5
answers
53k
views
How to DisplayAlert in a .NET MAUI ViewModel
I went through the "Build mobile and desktop apps with .NET MAUI" path on Microsoft Learn. Now that I have a simple working MAUI app, I'm trying to make it MVVM using CommunityToolkit.MVVM.
...
12
votes
2
answers
13k
views
.NET MAUI: can we also have platform-specific XAML?
I read, that we can use platform-specific C# in MAUI projects, but I have the need to use a platform-specific XAML file. Couldn't find anything in the docs.
Background:
On Android a SwipeView inside a ...
29
votes
6
answers
22k
views
NETSDK1083: The specified RuntimeIdentifier "win10-x64" is not recognized
When building a .NET MAUI app on Windows using .NET v8.0.100-rc.1.23455.8, I get the following error:
NETSDK1083: The specified RuntimeIdentifier "win10-x64" is not recognized
On the .NET ...
14
votes
5
answers
26k
views
How to implement .NET MAUI localization
I'm unable to find any direction on implementing localization for a MAUI app. I've read some info about localizing Xamarin apps but am unable to translate it forward to MAUI even after extensive web ...
8
votes
5
answers
4k
views
How to open WinUI Maui through URI Activation?
I've created a Maui windows application. I'm looking to activate the application through a URI and pass query parameters to the app.
I've added the windows protocol for calling the app via uri in the ...
2
votes
2
answers
5k
views
.Net MAUI WebAuthenticator CallbackUrl for social logins
I'm following this guide to setup authenticating with social logins using MSAL and Web Authenticator. The example call looks like this:
WebAuthenticatorResult authResult = await WebAuthenticator....
65
votes
28
answers
51k
views
New .Net MAUI App project throws 'The name 'InitializeComponent' does not exist in the current context' build errors
I've attempted to play with .Net MAUI and I've setup my development environment following the steps as described in:
https://learn.microsoft.com/en-us/dotnet/maui/get-started/first-app?pivots=windows
...
20
votes
3
answers
18k
views
Publish .net MAUI Application as windows executable
How can I publish a .net MAUI Application to a Single executable? Is this even possible?
I Have an application which I want my friends to use on their Windows PC. Is there any way without using the ...
15
votes
6
answers
16k
views
"Trust anchor for certification path not found." in a .NET Maui Project trying to contact a local .NET WebApi
I'm new to mobile development and I'm trying to have my .NET Maui app connect to a local ASP.NET Core website (API).
I am currently blocked by this exception:
System.Net.WebException: 'java.security....
12
votes
10
answers
13k
views
MAUI app not working in release mode but it works perfectly in debug mode
My MAUI App when running in Debug mode in a emulator is working good but it is not running when I run this in release mode ( does not work either in emulator or a physical device) it crashes.
I am ...
11
votes
2
answers
14k
views
How to create an Android foreground service in MAUI
I'm trying to create a foreground service in MAUI (using .NET 6) for an Android app, but currently, there are no tutorials (that I could find) on achieving this.
What would be the best starting point ...
5
votes
2
answers
7k
views
Binding a command to a parent view model in MAUI
I'd like to reference a parent viewmodel as a command binding.
I was expecting the MAUI syntax would work like the Xamarin does but I get the following errors:
'}' expected
'�' expected
Here is the ...
4
votes
3
answers
10k
views
Mouse hover detection in .NET MAUI
I want to detect mouse hovering over visual elements in .NET MAUI ( like buttons ). I cannot find any "onmouseover"/"ismouseover" events for this. How can I implement this.
3
votes
1
answer
2k
views
Dependency Injection when nesting Views in MAUI
I am attempting to nest Views, which use MVVM and hence have a ViewModel injected into them.
The code behind for the OuterView as well as the xaml for the InnerView are not really relevant, so I am ...
3
votes
1
answer
5k
views
.NET MAUI Image wrong size
I'm having a problem when I show an image on .NET MAUI, the size of the image is always bigger than it actually is (blue part in the image below).
My code is as follows:
<Grid>
<...
3
votes
3
answers
4k
views
MAUI Webview target="_blank" href redirects not working on android
I have an MAUI app that is essentially a WebView that hosts a wordpress website.
My problem is that whenever I try to load an external link it will simply not load the "href" redirect... It ...
51
votes
2
answers
23k
views
How can I remove the platforms I do not need to compile for in .net MAUI?
I only want to make a project for MacOS and Windows, no need for Android or iOS. I tried deleting the platforms from the folder called "Platforms" but they seem to regenerate each compile. ...
26
votes
11
answers
28k
views
Need a way to hide soft keyboard in MAUI's Editor / Entry fields
I found what seems to be useful in this link:
A Keyboard disabled Entry control in Xamarin Forms
But it seems that it only works in Xamarin Forms. I even used it in my MAUI app, but it simply has no ...
12
votes
7
answers
20k
views
Change Color of Entry Underline or Remove this Color
In my .NET MAUI Entry, I wanted to change the Color of the Underline in an Entry in Code-Behind.
Is there a way to do this?
======= Edited with implementation of Answer below ======
Hint: I tried the ...