Hi,
I'm using the XamComboEditor from the xmlns:ig="http://schemas.infragistics.com/xaml" namespace
<ig:XamComboEditor x:Name="cEdtUser" VerticalAlignment="Center" FontSize="{StaticResource FontSize}" Margin="{StaticResource Margin}" Grid.Row="0" Grid.Column="1" ItemsSource="{Binding Users}"> <ig:XamComboEditor.ItemTemplate> <DataTemplate> <TextBlock Text="{Binding DisplayName}" /> </DataTemplate> </ig:XamComboEditor.ItemTemplate> </ig:XamComboEditor>
Users is a ObservableCollection of user objects, and DisplayName is one of the properties of the user class.
Issue 1)
In expanded mode everything looks fine.
But once I select an Item e.g. dgeiss, I get the following result.
Well "Darius" is the content of another property of the user object with the DisplayName "dgeiss", but not the one I set in the ItemTemplate.
What am I doing wrong? I follwed the example "Using Data Templates for ComboEditor" from the SampleBrowser.
Issue 2)
I'm also using an ItemsFilter with the XamComboEditor.
// Creates new ComparisonCondition object ComparisonCondition condition = new ComparisonCondition(); // Sets comparison operator - Contains condition.Operator = ComparisonOperator.Contains; condition.CaseSensitive = false; ItemsFilter customItemsFilter = new ItemsFilter(); // Adds ComparisonCondition object into ItemsFilter Conditions collection customItemsFilter.Conditions.Add(condition); // Sets created ItemsFilter as CustomItemsFilter of XamComboEditor cEdtUser.CustomItemsFilter = customItemsFilter;
Using the same example from Issue 1:
If I type "is", I get "Admninistrator" and not as expected "Administrator" and "dgeiss". I think this has something to do with the first issue, or am I wrong?
Kind regards,
Darius Geiss
Hello Darius,
Thank you for your post. I have been looking into your issue and my suggestion to set the ‘DisplayMemberPath’ property of the XamComboEditor to the desired property of your data source. I was trying to reproduce the issue setting ItemTemplate without any success.
I am attaching a sample application(ComboEditorItemIssue.zip) that shows my suggestion.
If it does not fit your scenario, could you please modify my sample application or attach your own application with descriptive screenshots of the issue?
Looking forward to hearing from you.
Hello Yanko,
your solution works great. Thank you.
Nevertheless I'm wondering why the sample "Using Data Templates for ComboEditor" from the WPF Samples Browser 13.1, that doesn't have a 'DisplayMemberPath', shows the correct ItemTemplate in the collapsed mode. Right now I don't need the ItemTemplate to be shown in the collapsed mode, but it mighty be very helpful in future.
Darius
Thank you for your feedback. The referred sample from the Sample Browser shows the correct ItemTemplate when the XamComboEditor’s dropdown is collapsed because its ‘IsEditable’ property is set to “False”. If you check the ‘Enable Editing’ checkbox in the sample, you will see that the ItemTemplate is not applied when the dropdown is collapsed. Currently this is the design behavior of the control.
In your current scenario there is no need of setting an ItemTemplate because you would like to show one specific property from your underlying data in the XamComboEditor.
Please let me know, if you need any further assistance on this matter.
Thank you again.
Hi Darius,
Thank you for your feedback. I am glad that you have managed to resolve your issue.