Hi,
I use Infragistics.Controls.Editors.XamComboEditor (AllowMultipleSelection = True; IsEditable = False) and I need to have different template for selected item and drop down item. I use the following data template for the ItemTemplate property:
<DataTemplate x:Key="FlatComboEditorItemTemplate"> <StackPanel Orientation="Horizontal" Margin="0,1,0,0"> <Image Source="{Binding Icon}" Width="16" Height="16" Margin="3,1,0,0" /> <TextBlock Text="{Binding Name}" Margin="5,0,0,0" /> </StackPanel> </DataTemplate>
This works, but it applies both for selected item and drop down item. For the selected item, I would need to display only the Icon (the Name should not be visible).
Is there any way I can accomplish this?
Thanks.
Hello Florian,
Thank you for contacting Infragistics!
There is still one template that is shared between the items displayed in the dropdown and what is displayed in the input of the editor of the combo. If your current method is not working you can look into this alternate method of overriding the template:Override what is displayed in textbox of the XamComboEditor
it's been 5 years since the last post was written, are there now two different templates?
We are having the same problem and i cannot fix it with the "SelectionChanged" solution. Because for some reason the first item in the dropdown list gets modified and i don't know why. I attached a sample project to show my case.i would like to achieve that only the "Value" is displayed for the selected item. When IsEditable=False
Using InfragisticsWPF4.Controls.Editors.XamComboEditor.v17.1XamComboEditorIsEditable.zip
I am happy about every answer.
Thanks!
Hello Ioan,
Thank you for the feedback. Please do not hesitate to let me know if you have any further questions on the matter.
Hi Gergana,
Meanwhile I found out that the only way I can achieve the behavior I need is by accessing the SelectedItem object during runtime, via the SelectionChanged event of the XamComboEditor.
The item needs to be cast to the type that I'm binding to in the underlying data and the exposed property for the object that I'm using to display its name in the associated ItemTemplate is set to an empty string, this change is propagated to the SelectedItem field in the editor and the display text for items within the list remains static, assuming that I'm not implementing the INotifyPropertyChanged interface within the underlying item’s class.
Hope this will help other people searching for the same behavior.
Thanks for your help.
Ioan
I am just checking your progress on the issue. Please do not hesitate to let me know if you have any further questions on the matter.