Hi,
I am trying to generate a derived UltraComboEditor that shows a different text version when collapsed and dropped down, effectively having more detail when dropped down. I populated a combo box with ValueListItems with the detailed text as the display text. This shows when dropped down. Then I used a datafilter to remove this extra detail in the EditorToDisplay direction.
This works to display the detailed text when dropped down and the reduced text when item is selected. But when trying to move off the control, the combo selects the null item (presumably based on the text not matching any valuelist items) Also, I've set it to LImitToList, so the control now won't lose focus.
Is there a way to have two different versions of the display text to be used? Also, is there a sample of a dataFilter applied to an UltraComboEditor as I can find no articles for this.
Thanks
Wendy
Hello ,
I am glad to hear that you were able to solve your issue.
Thank you for using Infragistics Components.
I've managed to get this working using two different value lists and a fair bit of trial and error to get the behaviour I require. I want the ultraComboEditor to behave 1) like a value picker so set LimitToList = true 2) provide suggest functionality so set as DropDown to allow the user to type in the text box and 3) offer more detailed text when dropped down than when displaying the selected item.
Taking an idea from the ControlContainerEditor, I set up two value lists with the properties of the combo.ValueList using Clone(). These were then populated with DisplayText appropriate to the DroppedDown and not DroppedDown cases. (Note if one list is referenced directly to this.ValueList it will be cleared when switching between lists ??? not sure why)renderingVList = this.ValueList.Clone(); editingVList = this.ValueList.Clone();this.ValueList = renderingVList;Then override the methodsprotected override void OnBeforeDropDown(CancelEventArgs args){ this.ValueList = editingVList; if(this.SelectedIndex > -1 && hasDropDown) //item is selected, not filtering; ValueList has created the DropDown else null reference error ((IFilterableValueList)this.ValueList).RemoveFilter(); base.OnBeforeDropDown(args);}private bool hasDropDown;protected override void OnAfterDropDown(EventArgs args){ hasDropDown = true; if (this.SelectedIndex < 0) //user must have typed in text, i.e. filtering ((IFilterableValueList)this.ValueList).ApplyFilter(this.EditorWithCombo.CurrentEditText, this.AutoSuggestFilterModeResolved); base.OnAfterDropDown(args); }protected override void OnAfterCloseUp(EventArgs args){ int idx = this.SelectedIndex; //trap idx in case the list was filtered this.ValueList = renderingVList; if (idx > -1) { this.SelectedIndex = idx; this.textValue = this.SelectedItem.DisplayText; if (this.EditorWithCombo.IsInEditMode) //required to update the Editor text when user selects the same item this.EditorWithCombo.TextBox.Text = this.SelectedItem.DisplayText; } base.OnAfterCloseUp(args);}I've also overridden Value and ValueChanged to make it act like a valuePicker, i.e. Value is null or correct type, and ValueChanged events fire only when selected item changes not for all text changes.
This works for my scenario where the two valueLists are the same except for the text. The two valuelists might be a nice feature to add to the UltraCombo.
Regards,
Hi Wendy,
I don't think that the approach you are taking (using a DataFilter) will work. The DataFilter is going to get called and change the DisplayText and that text is not going to match any values on the list, so that's probably why you are getting nulls.
What you really need here is a way to change the display of the combo when it is dropped down without affecting the text or value.
If you are allowing your users to type into the UltraComboEditor, then I don't see any way to make this work. When the control goes into edit mode, it displays a TextBox control over itself by default and there is no way to change the display of that TextBox without changing it's text.
But, if you are setting DropDownStyle to DropDownList, which prevents the user from typing, then the control does not use a TextBox and you might be able to get what you want using a CreationFilter. The CreationFilter (or possibly a DrawFilter) will let you change the text of the UIElements which display on the screen without affecting the actual value or text of the control.