-1

Say what I have is an ObservableCollection<People> ListOfPeople such that:

public class People
{
    public string Name { get; set; };
}

I have a combobox written equivilent to:

<ComboBox x:Name="combobox_Profiles" Text="Select Person"
          ItemsSource="{Binding Path=???}">

How can I set the items within the combobox to be the value of each Name property? I thought I knew how to do this, but I clearly do not.

1 Answers1

1

To select what to show in the case of a single property use the DisplayMemberPath and set it to Name.

You can also set the SelectedValuePath if you want the control to return a specific property of the object rather than the object itself.

Sami Kuhmonen
  • 30,146
  • 9
  • 61
  • 74