ItemsControl DİsplayMemberPath property does not work

40 Views Asked by At

In the following code, the variable named attributes is defined as a collection of SchemaAttribute objects, in which each object has a "Name" property and bunch of other properties. I create an ItemsControl object and bind the attributes to it. I also have an Expander object and the data is stored in the expander object.

Expander expander = new Expander();

var attributes = _dataProvider.GetSchemaAttributes();

ItemsControl itemsControl = new ItemsControl();

itemsControl.ItemsSource = attributes;
itemsControl.DisplayMemberPath = "Name";

expander.Content = itemsControl;

Using DisplayMemberPath makes expander's content empty. How can I display the Name property properly?

expander

0

There are 0 best solutions below