- Product, version, build: Powershell Studio v5.6.163
- Specify if you are running a 32 or 64 bit version: 64 bit
- Your operating system and if it is 32 or 64 bit: Win10 64 bit
Hello everyone,
I have a combobox of which I am dynamically updating the items within my code based on certain keypresses. The issue I'm encountering is:
The combobox starts out displaying what looks to be 30 items. The list of items then changes as keys are pressed, and eventually the list becomes shorter than 30 items. The combobox then does not shrink its display to match the number of items, but rather remains expanded at its size which would show 30 items, and I can verify that the items are in fact removed. The $combobox.Items.Count property shows the expected number of items.
I feel like the control should auto-size itself as the items are added or removed. The only thing that I can think of that may be causing an issue is that I am setting the $combobox.DroppedDown property to true.
Any thoughts/input on this? Is there a better way to do it?
Combobox dropdown not changing size
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Combobox dropdown not changing size
Using any normal methods I cannot reproduce you issue.
Note that the "DroppedDown" property I mostly useful for detecting that the list is displayed. While the list is displayed it will not change. Un-display the list a redisplay it and it will be correct.
Note that the "DroppedDown" property I mostly useful for detecting that the list is displayed. While the list is displayed it will not change. Un-display the list a redisplay it and it will be correct.
Re: Combobox dropdown not changing size
That's the issue, though. I need it to be displayed. The reason all of these events are happening is because I'm handling a custom smart search script that allows for (essentially) ANR, and I have to tell the dropdown to expand in order for it to display. If I retract the dropdown, whatever the user is typing in the combobox gets deleted since it wasn't confirmed.
Re: Combobox dropdown not changing size
You are trying to use the control in a way that it is not designed to be used. You will have to create a custom display that is like the dropdown that you can control as you like from your code.
Re: Combobox dropdown not changing size
Well, I ended up hacking up a workaround. It's not the cleanest thing and it introduces a minor amount of flicker, but at least for the meantime it will work. I'll experiment more next week.