Picker item source binding from view model

Viewed 3937

I am trying to bind the values for a picker from a model in view model, there I am getting path of the model instead of the values.

<Picker x:Name="LocationPicker"
    Title="Location" HeightRequest="40"
    HorizontalOptions="FillAndExpand"
    VerticalOptions="FillAndExpand"
    SelectedItem="{Binding Location}"
    ItemsSource="{Binding MaintainRoomTypes}"/>

Here is my view model code:

if (jobDetailsForFitter != null)
{
    WindowDetails = new WindowDetailsModel
    {
        Windows = jobDetailsForFitter.Windows,
        Locations = jobDetailsForFitter.Locations,
        RoomTypes = jobDetailsForFitter.RoomTypes,
        AddFiles = jobDetailsForFitter.AddFiles
    };

    Locations = jobDetailsForFitter.Locations;

    MaintainRoomTypes = jobDetailsForFitter.RoomTypes;

    await FitterService.Instance.LoadJobDetailsToLocalStore(jobDetailsForFitter, SelectedJob?.Id ?? 0);
}

how to bind itemsource to get list.

public List<Room> Locations { get; set; }
public List<RoomTypeModel> RoomTypes { get; set; }
1 Answers
Related