Hi,I have listview inside of UltraExpandableGroupBox.I want to make the control larger or smaller when listview item is added or removed.I found that UltraExpandableGroupBox has Panel inside it and has AutoSize Property.I set the AutoSize to true, and also make another property grow and sink.However, the UltraExpandableGroupBox size doesn't change at all,Is there any other options that I need to set ?How to achieve this ?
Thanks
Hello Mario,
The 'AutoSize' property of the UltraExpandableGroupBox control is hidden in the Intellisense and the Property Grid in the designer but still can be set to 'true', by adding the following line inside your code: this.ultraExpandableGroupBox1.AutoSize = true;
Please let me know if you need further assistance.
Regards,Ivan Kitanov
If that property is hidden, it's probably hidden for a good reason. And I am almost certain it's not going to work the way you want it to. The Panel control is managed by the UltraExpandableGroupBox, so you really should almost never be setting properties on that panel directly. I feel confident that setting AutoSize to try on the panel is not going to do what you want, and it may cause problems. So I strongly advise against doing that.
If you want an expandable window to wrap a single control, you might want to consider using UltraDockManager, instead. That will give you a dockable, pinnable window like Visual Studio has, and it will size to the control - at least in one dimension.
If you want to size the UltraExpandableGroupBox to a control, then you can achieve this by simply setting the ClientSize property. I have attached a quick, simple sample here.
WindowsFormsApp15.zip
Hello Ivan,
Haven't tried it yet,but my questions already answered.Thanks for your support
Did you have the chance to try out the solution that Mike suggested?
Please let us know if you need any further assistance.
Regards, Ivan Kitanov
Hi Mike,
I got it. It seems impossible to do that with listview.Will consider your solution or think another way.Thanks
Mario Saputra said:Is there anyway for ExpandableGroup to know the necessary height to follow listview size ?
Okay, so now the question is no longer even about the UltraExpandableGroupBox, you are asking how to autosize the ListView or UltraListView to it's contents. As far as I know, there is no way to do that. ListView generally shows a scrollbar so that the user can view the items by scrolling and I am not aware of any ListView control(s) that can size itself to content. Of course, if you only have 2 options (images or no images) then you could just size it manually and then hard-code those two numbers. But there might be other factors involved like scaling or high-def monitors, etc. So that might not work in all cases unless you have a fixed user base that are all running on company machines that are all the same or something.
Thanks for your answer.I think ExpandableGroup is more suitable for my project.So based on your answer I need to set the size by program.The problem is, I am using ListView with icon display,the icons can be added or removed dynamically.I want the expandable group show all icons (we don't want scrollbar or extra space).Is there anyway for ExpandableGroup to know the necessary height to follow listview size ?