Hello,
we have the problem that in some scenarios a popuptool can have many items, so wie would like to implement a filter with a TextboxTool. So every time the value of the textbox changes, we iterate over the tools and change Instance- (or Shared)Props.Visibilty. But that doe not have any effect until the popup is closed and reopend.
Is there any way to force a refresh, so the items get immediately filtered?
thanks
carl
Hello Carl,
I have been investigating into the behavior you are looking to achieve, and would it be possible for you to please provide a little more information on the PopupTool that you are looking to filter items from in this case? Is this a PopupContainerTool, PopupMenuTool, or perhaps even a Popup Gallery? Can you please confirm which of the popup tools you are using?
If you also have an isolated sample project for this that you could provide here, this also may expedite my investigation into this behavior.
Please let me know if you have any other questions or concerns on this matter.
Hello Andrew,
thank you for your reply.
I think this code should answer your questions...
private void ultraToolbarsManager1_ToolValueChanged(object sender, Infragistics.Win.UltraWinToolbars.ToolEventArgs e) { if (e.Tool.Key == "IndexSelectionTemplateFilter") { var filterString = ((Infragistics.Win.UltraWinToolbars.TextBoxTool)e.Tool).Text.Trim().ToLower();
var popupTool = (Infragistics.Win.UltraWinToolbars.PopupMenuTool)this.ultraToolbarsManager1.Tools["IndexSelectionTemplates"];
var templateTools = popupTool.Tools.OfType<Infragistics.Win.UltraWinToolbars.ButtonTool>().Where(p => p.Key.StartsWith(this.selectionTempalteToolKeyPrefix)).ToArray();
foreach (var templateTool in templateTools) { templateTool.SharedProps.Visible = (filterString == string.Empty || templateTool.SharedProps.Caption.ToLower().Contains(filterString)); } } }
Here we are reacting to the ValueChangedEvent from the TextBoxTool (this filter) and apply the visible state to the MenuItems (ButtonTools).
The filter and the ButtonTools are on the same level and popped out in this moment. Like this....
- FilterTool
- ButtonTool1
- ButtonTool2
- ,,,
When chaning the filter the visibility of the ButtonTool1-n is changed.
Ot to be more specific: The TextBoxTool is part of popupTool.Tools too.
Carl