I have to use some sort of dropdown/popup solution due to screen realestate of a tablet. One of the dropdowns needs to allow multiselection but by default all the selected values populate the textbox with a separator. Is there a way to override what the combobox displays so that it always displays a static string but only in multiselection mode?
Thanks. Your sample did help me figure out how to override the text after deselection.
Hello Mike,
Just checking in, did you have any other questions or concerns on this matter?
Sincerely,AndrewDeveloper Support IInfragistics Inc.www.infragistics.com/support
I have found a solution using the MultiSelectContentPanel StackPanel and the SelectionChanged event of the XamComboEditor. Directly after the if-statement that checks to see if the SelectedItems count is greater than 1, I placed a Dispatcher around the statements that clear out the StackPanel and add the TextBlock in as a child.
There must have been some other processes going on in the background when an item is deselected. This solution waits for those to finish, and then changes the StackPanel.
I have attached a sample project to demonstrate.
Please let me know if you have any other questions or concerns on this matter.
I made my XamComboEditor not editable. That seems to break your suggestion since that component is not visible. I tried working directly with the MultiSelectContentPanel and that works except when using checkboxes and unselecting one of the group. If I keep selecting then my custom code works but as soon as I deselect one (or more) and there is still at least one selected then it reverts back to using the concatenated list. Alomost as if there is another event that fires after the selection changed event. This is reproducible with your sample as well, just mark the comboeditor as IsEditable=false.
Thanks!
First of all, I apologize for the delay in my response, but I have attached a sample that I believe will solve this issue you are having.
The XamComboEditor that is in InfragisticsWPF4.Controls.Editors.XamComboEditor.v14.1.dll is the shared one. The WPF only one does not support multi-selection.
Regarding switching the text of the combo editor, you will need to obtain the SpecializedTextBox from the XamComboEditor and switch it based on how many items are selected. Also, for the XamComboEditor, you will want to set CustomValueEnteredAction to Allow or it will never let you set the static string in the Editor. Also, you will want to set AllowFiltering and AutoComplete to False, because it will not show anything in the editor after the string shows up if you don’t.
It is tempting to obtain the SpecializedTextBox and change the text property in the SelectionChanged event, but that also clears out your selection when the TextBox changes. What I did in my sample to get around this is I obtained the SpecializedTextBox in the XamComboEditor Loaded event, and then hooked up a TextChanged event to that TextBox. In the TextChanged handler, I check the XamComboEditor.SelectedItems.Count and change the SpecializedTextBox text accordingly.
Again, the sample project is attached to this message.