When displaying a different tooltip per item in a XamComboEditor’s combo box style there is a binding error that displays in the output window. As far as I can tell this error indicates that I cannot use display member path on the XamComboEditor for the selected item as well as bind the combo box style’s text block text property also. If I comment out the display member path I do not get the error but the selected item does not display properly; I see the name of the property and not the contents of the property.
How do I properly display the item’s property both in the combo box style and as the CellValuePresenter’s text without the binding error?
Hello Travis,
Thank you for your post!
The reason you are seeing this error is because you are setting the ItemTemplate of the ComboBox and the DisplayMemberPath property. This error is more like a warning telling you that since both the ContentTemplate and the ContentTemplateSelector are set, the ContentTemplateSelector will be ignored. This error arises because when you set the DisplayMemberPath, this is used to tell the ItemsControl which property to display when showing your objects. When you pass in a custom ItemTemplate, you are choosing how to show the object within that ItemTemplate. In other words, when you set the DisplayMemberPath on the XamComboEditor, it is carrying over to the ComboBox it uses when editing. If you tried setting a DisplayMemberPath and an ItemTemplate on a WPF ComboBox, you would receive this same error.
To achieve your requirement, I would recommend that you remove the ComboBoxStyle, since you are only setting the tooltip. Then, inside of the XamDataGrid.Resources, write a new style for ComboBoxItem which sets the ToolTip property.
I have attached a modified version of the sample you sent to demonstrate the above.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate DeveloperInfragistics Inc.www.infragistics.com/support
This works. However, in my actual application, I have 3 XamComboEditors. How would i go about doing that, since I couldn't use an implicit styled ComboBoxItem, since I'd need all 3 to have different tooltips of differing properties etc.
Just checking in, did you have any other questions or concerns on this matter?
Since you have more than one XamComboEditor, I would recommend that you move the ComboBoxItem styles from the XamDataGrid.Resources section to the Style.Resources section for the style for the particular XamComboEditor that you wish to style. This will apply your tooltip binding to only that particular XamComboEditor.