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
Thank you for your update on this matter.
I have been investigating further into the behavior you are seeing, and I am able to reproduce it. The only workaround I have been able to find outside of closing and reopening the popup is to instead remove the tools from the PopupMenuTool.Tools collection rather than setting their SharedProps.Visible property, but this adds a new aspect to achieving your behavior in that you would need to have a collection of the tools that you want to be there when no “filter” is present so they can be added back in.
I believe this is unexpected behavior of the control, and I have asked our engineering staff to examine it further. To ensure this receives attention, I have logged this behavior in our internal tracking systems with a development ID of 272956 and I have opened a private support case for you on this matter that I will be linking this issue to so you can be notified when a fix or other resolution becomes available. This support case has an ID of CAS-212378-T6Z6J8 and you can access it after signing into your account, here: https://es.infragistics.com/my-account/support-activity.