Wpf debug error output System.WIndows.Data Error 25

I have a special Combobox style that works great. It is placed inside user control and is tied to a data structure. I use DisplayMemberPath to display only one item in a Combobox TextBox. The ComboBox style is taken from MSDN and is used many times. Therefore, it is not displayed here.

<UserControl x:Class="wpf.projext1.MyComboBox"
         x:Name="MyControl"
         ...
    <ComboBox Style="{StaticResource ComboBoxStyle}"
                  Text="{Binding ElementName=MyControl, Path=Text}"
                  IsEditable="True"
                  IsTextSearchEnabled="False"
                  StaysOpenOnEdit="True"
                  ItemsSource="{Binding ElementName=MyControl, Path=MyItemsSource}"
                  DisplayMemberPath="Name"
    </ComboBox

I get the following annoying error message populating the output window:

System.Windows.Data Error: 25 : Both 'ContentTemplate' and 'ContentTemplateSelector' are set;  'ContentTemplateSelector' will be ignored. ComboBoxItem:'ComboBoxItem' (Name='')

if i leave

DisplayMemberPath="Name"

... the debug output of error 25 is not displayed. But I definitely need DiplayMemberPath = "Name"! Do you have an idea to fix this?

+5
source share
2 answers

Permitted: Use the attached TextSearch property, regardless of whether TextSearch is enabled!

TextSearch.TextPath="Name"
+7

DisplayMemberPath, ItemTemplate.

DisplayMemberPath ItemsControl, . , ItemTemplate, ItemTemplate.

Combobox MSDN ItemTemplate, , , .

+11

All Articles