0

I am wondering if anyone know something about this issue. It seems like the default template provided here for ListViewItem does not support DisplayMemberPath of ListView.

Example

<ListView ItemsSource="{Binding SomeSource}" DisplayMemberPath="Name" />

will not display the items as expected. It will work if I replace the GridViewRowPresenter with a ContentPresenter. So my workaround to write a fully working template is to write a DataTrigger for DisplayMemberPath with Value="" and there I set the Template to a Template containing the GridViewRowPresenter. If I will not do this a GroupStyle with ItemsPresenter will not work.

My Question: Is this a bug or am I doing something wrong?

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Daniel Bişar
  • 2,663
  • 7
  • 32
  • 54

1 Answers1

3

I asked a similar question here

The DisplayMemberPath property is actually a shortcut that will tell WPF to create the default item template with nothing more than a TextBlock with it's Text bound to whatever field is in DisplayMemberPath

If you overwrite the item template in addition to setting DisplayMemberPath, then you are essentially overwriting the template that DisplayMemberPath created for you, so that property becomes useless.

Community
  • 1
  • 1
Rachel
  • 130,264
  • 66
  • 304
  • 490