This project is read-only.

System.Windows.Data Error: 25

Apr 29, 2015 at 3:39 PM

I have create a own Controll and want to set the DisplayMemberPath of a listbox that contained in the usercontroll.

Following error came up:
System.Windows.Data Error: 25 : Both 'ContentTemplate' and 'ContentTemplateSelector' are set;  'ContentTemplateSelector' will be ignored. ListBoxItem:'ListBoxItem' (Name='')
The reason is following: "You cannot set both DisplayMemberPath and ItemTemplate at the same time.

DisplayMemberPath is used to tell the ItemsControl which property to display when showing your objects. It makes no since to set this field if you're already passing a custom ItemTemplate, since you can choose how to show the object within that ItemTemplate."

I can read them - but I don´t know how can I fix that in your Framework. Can you give some help for that?
Apr 30, 2015 at 8:52 AM
DisplayMemberPath sets which path to use for displaying a value. An item template defines what to show for each item in a more complex fashion. It is kind of a "super display member path" if you want to think of it like that. Or, you can think of it as DisplayMemberPath being a shortcut for setting a very simple template that only contains a single name to display. Either way, you can only use one or the other, but not both. The ConentTemplateSelector allows you to go one step further and specify which template to use if you have more than one template. That would override a hardcoded template. So you also can't set both of these at the same time.

This has nothing to do with our framework, btw. This is just standard WPF stuff. I can give you some quick pointers like I am doing above, but I would also recommend to take a look at Microsoft's WPF documentation or at many of the other sources, because these topics are way too big to address just in a quick forum post here.