I want to retrieve a list of materials from Firebase and display them in a picker. Problem, the response with the materials from Firebase comes only after navigating to the page and the content of the picker does not update. (Windows)
xaml.cs
public partial class CreateManufacturingStepPage : ContentPage
{
    CreateManufacturingStepViewModel viewModel;
    public CreateManufacturingStepPage(CreateManufacturingStepViewModel vm)
    {
    InitializeComponent();
        BindingContext = vm;
        viewModel = vm;
    }
    protected override void OnNavigatedTo(NavigatedToEventArgs args)
    {
        //my last try to make it work
        Task.Run(async () => {
           var x = await DBConnection.materialHandler.GetAll();
           x.ToList().ForEach(material => viewModel.Materials.Add(material));
           //also dont work: viewModel.Materials = await DBConnection.materialHandler.GetAll();
        });
        base.OnNavigatedTo(args);
    }
}
.xaml
                <Picker x:Name="rawMaterialPicker" Grid.Row="0" Grid.Column="1" HorizontalOptions="End"  ItemsSource="{Binding Material}" SelectedItem="{Binding ManufacturingStep.RawMaterial}">
                    <Picker.ItemDisplayBinding>
                        <Binding Path="MaterialDescription" />
                    </Picker.ItemDisplayBinding>
                </Picker>
.cs
    [ObservableProperty]
    ObservableCollection<Material> materials;
    public CreateManufacturingStepViewModel()
    {
        Materials = new ObservableCollection<Material>();
    }
I have already tried the workaround without success: https://github.com/dotnet/maui/issues/9739
Task.Run(async () => {
           var x = await DBConnection.materialHandler.GetAll();
           x.ToList().ForEach(material => viewModel.Materials.Add(material));
           //also dont work: viewModel.Materials = await DBConnection.materialHandler.GetAll();
});
I tried it in the OnNavigatedTo() and in the constructor of the view model.
I also tried this: https://stackoverflow.com/a/52804117/20589753
I was hoping that this would allow the picker to preserve his items.
The connection with Firebase can be ruled out as a problem, as I receive a response to my request with content.
Edit: for binding I tried already
Task.Run(async () => {
           var x = await DBConnection.materialHandler.GetAll();
           x.ToList().ForEach(material => viewModel.Materials.Add(material));
           rawMaterialPicker.ItemsSource = viewModel.Materials;
        });
and
        <Picker x:Name="rawMaterialPicker" Grid.Row="0" Grid.Column="1" HorizontalOptions="End"  ItemsSource="{Binding Materials}" SelectedItem="{Binding ManufacturingStep.RawMaterial}">
            <Picker.ItemDisplayBinding>
                <Binding Path="MaterialDescription" />
            </Picker.ItemDisplayBinding>
        </Picker>
 
    