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 Ioan,
Thank you for your post. After some research I have made for you, I can suggest to take a look at the following forum thread: http://es.infragistics.com/community/forums/t/26793.aspx. There you can find a working sample and more information about the functionality you have described. You can create a converter that converts the text that is displayed to show the desired content.
Please refer to the above mentioned link and feel free to let me know if you have any further questions on the matter.
Thanks for the link.
It seems that solution applies for Infragistics.Windows.Editors.XamComboEditor, but I use Infragistics.Controls.Editors.XamComboEditor which does not have the specified converters (ValueToDisplayTextConverter and ValueToTextConverter).
For Infragistics.Windows.Editors.XamComboEditor, there is a simple solution to accomplish the behavior I need (I would just have to set the ComboBoxStyle property and provide different templates for selected item and drop down item; this can be accomplished by setting the ItemTemplateSelector property of the default WPF ComboBox).
Unfortunately, the Infragistics.Controls.Editors.XamComboEditor does not provide converters, ItemTemplateSelector or ComboBoxStyle properties.
Any other suggestion would be highly appreciated.
Thanks,
Ioan
I have been further researching your issue. Currently the functionality that you are using the best approach for your issue. Please do not hesitate to let me know if you have any further questions on the matter.
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.
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.