Question

The problem is that I have to fill out a ListPicker with the objects that I have saved in the database, but only with the object name.

I can populate the list using the ItemsSource property, but the list is being populated with the following "Traveler.Model.Car", and I need the correct name of each object.

After that, still need to use their property, but this is easier.

Xaml:
<toolkit:ListPicker Name="lpCars" ItemsSource="{Binding Items}"/>

 private void GetCarList()
        {            
            using (UtilsManagerDataBase getList = new UtilsManagerDataBase())
            {
                this._cars.Items = new ObservableCollection<Car>(getList.GetCarList());                
            }      
        }
Was it helpful?

Solution

Something like this would help.

Make a listpicker like this in your xaml.

<toolkit:ListPicker Name="lstCars" VerticalAlignment="Top" Width="220" >
                <toolkit:ListPicker.ItemTemplate >
                    <DataTemplate >
                        <TextBlock Text="{Binding PropertyName}"/>
                    </DataTemplate>
                </toolkit:ListPicker.ItemTemplate>
                <toolkit:ListPicker.FullModeItemTemplate>
                    <DataTemplate >
                        <TextBlock Text="{Binding PropertyName}" FontSize="28"/>
                    </DataTemplate>
                </toolkit:ListPicker.FullModeItemTemplate>
            </toolkit:ListPicker>

an assign the list as an itemsource to the listpicker in c# like

lstCars.ItemSource=Your List;

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top