Shows DI/IoC for app, page, and view model.
Checkout my YouTube videos on .NET MAUI!
Note: That [ICommand] is now [RelayCommand] from the .NET community toolkit!
Shows DI/IoC for app, page, and view model.
Checkout my YouTube videos on .NET MAUI!
Note: That [ICommand] is now [RelayCommand] from the .NET community toolkit!
I am getting really frustrated with MAUI - every time I come back to it, it is the same thing - following example code and it does not work :-(
So I have a button on a page and a command then when on clicked does await Shell.Current.GoToAsync( nameof( NewCoursePage ) );
However, that generates the following exception:
I have registered my View and ViewModel with the Service container:
builder.Services.AddTransient<NewCoursePage>();
builder.Services.AddTransient<NewCoursePageViewModel>();
I have also registered the route:
Routing.RegisterRoute( nameof( NewCoursePage ), typeof( NewCoursePageViewModel ) );
Looking at the exception it would seem to be something to do with passing the view model to the view (I use constructor injection of the view model into the view) but I can't see anything different in the code in this repo to my code.
Does anyone have an idea what I am doing wrong?
Andy
Hi James,
I'd like to test a TwoWay binding on an entry so I added this code to the grid of your MainPage.xaml:
<Entry
Grid.Row="5"
FontSize="18"
HeightRequest="40"
Text="{Binding Count, Mode=TwoWay}"
HorizontalOptions="Center" />
When I change the value in the entry, I expect to see a call to the Count setter but nothing happens.
What am I doing wrong?
When you register the services for IConnectivity, you use this code:
builder.Services.AddSingleton<IConnectivity>((e) => Connectivity.Current);
If I don't understand wrong, it means that when IConnectivity is requested, it is passeed Connectivity.Current, that is a specific implementation of IConnectivity. So it is not possible to pass another implementation.
So my cuestion is, if I have an own implementation of IConnectivity, how could I decide to use the Connectivity.Current or my own implementation?
Perhaps with the connectivity it has not too much sense, but I am thinking in general and for example in unit tests, in which I could be interested in using my own imlpementantion.
Thanks.
When using dependency injection, how do you ensure that any injected service that implements IDisposable is property disposed on application shutdown?
I am learning Maui, have a background in WPF. In WPF, you could dispose on an IHost instance in the App.xaml.cs OnExit method to ensure that all disposable resources are disposed.
I have not seen any documentation for anything like this for Maui.
Thanks. Great youtube video.
Example:
Want to extend what you have done and create following clean architecture layers
a. Domain (MAUI Class Library)
b. Data (MAUI Class Library)
Can you explain how to get the parent App to consume Domain
and Domain library to consume Data layer interfaces.
your MauiProgram.cs file registers services for view model
You do I register the domain and data layre services so they can be used across the layers correctly.
appreciate your guidance
for the Bluetooth permission in an Android; is there a way to activate automatically in the start of the Maui app without passing on the button to activate the Bluetooth.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.