enisn / UraniumUI

Uranium is a Free & Open-Source UI Kit for MAUI.
Apache License 2.0
984 stars 110 forks source link

AutoCompleteTextField doesn't work correctly when using explicit dependency resolution #654

Open codychaplin opened 4 weeks ago

codychaplin commented 4 weeks ago

Long story short, I discovered that, at least on Android, the dropdown menu doesn't show up at all while typing when the ItemsSource is bound using a viewmodel that was set via Handler.MauiContext.Services.GetService<>(). https://github.com/dotnet/docs-maui/blob/main/docs/fundamentals/dependency-injection.md#explicit-dependency-resolution

I made a repo to test it here: https://github.com/codychaplin/UraniumUITest. The AutoCompleteTextField works correctly when using constructor dependency injection, but not when using explicit dependency resolution. My repo shows the ItemsSource for 4 different AutoCompleteTextFields getting set in different ways. All ways work except for the one I described above.