-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding injected Pages to a TabbedView #9551
Comments
@ramonB1996 can you help here? |
You can work around this by using static ServiceProvider class and calling GetService in the TabbedPage constructor:
TabbedPage constructor:
|
In my case, I have a MainVm that holds an ObservableCollection of Page1Vm. I would expect each view model to be applied to a page. So this workaround won't work. :/
|
@matt-goldman Would love to help. I am only using Android at the moment in my own project with your library. @sinsedrix I have 3 small questions:
|
Here is a sample project: |
@sinsedrix Okay good to know. I will try this with your reproduction sample this week. Will get back to you. You could try the Page Resolver package by @matt-goldman in the meantime; https://github.com/matt-goldman/Maui.Plugins.PageResolver Follow the instructions and try if this resolves your problem :) |
An update was made on sinsedrix/MauiTests/MauiTabbedDI to land on a simple page. The default page displays well. The refresh manages to load tabs and the first displays. When trying to select another tab, I get again the previous error:
|
Duplicate of #6389 |
We've moved this issue to the Backlog milestone. This means that it is not going to be worked on for the coming release. We will reassess the backlog following the current release and consider this item at that time. To learn more about our issue management process and to have better expectation regarding different types of issues you can read our Triage Process. |
Description
TabbedView expects the children pages to have default constructor.
When a page constructor has an injected view model, it doesn't seem possible to add it to a TabbedPage.
Steps to Reproduce
https://github.com/sinsedrix/MauiTests/tree/main/MauiTabbedDI
Version with bug
6.0.486 (current)
Last version that worked well
Unknown/Other
Affected platforms
Windows
Affected platform versions
Windows SDK 19041
Did you find any workaround?
No
I tried to add a default constructor, but then the view model is not injected.
Relevant log output
The text was updated successfully, but these errors were encountered: