I can't find any documentation on how to size the dropdown portion of the combobox. I have two columns and 4 or 5 rows. I want all columns and rows to be visible when the use expands their selections. Right now it's only as wide as the combo and it's showing less than one row.
Thank you.
Mike
Rob,
Thanks again for your time. I did try resetting the height of the popup, but no matter what I set it to it would only show 2 1/3 rows. I'll take a look at your sample and then get back to you.
Hi Mike,
You should be able to get the height the same way you get the width. I've attached a sample that demonstrates setting both the width and height of the dropdown to show all the items in the grid. I've made some modifications to my previous sample to accomodate the extra code but the basic premise is still the same. To get the height of a row I first grab the header row and then the row after that in the rows collection. Then I use the ActualHeight property on the non-header row and multiply that by the number of rows in the grid and store this value. Afterwards I add the header row's height to this value and this gives you the total height used by the grid. Width in this case is still calculated the same as before but I add a bit of a buffer to it, just enough to make the width large enough so the scrollbar disappears.
There is another issue and that is we have lost the vertical scroll bar.
Any thoughts on this and on setting the height of the popup?
Thanks,
Rob, your solution to add an extra large value during the DropDownOpened event worked. One small matter, you have to set the width back and so I chose the DropDownClosed event and now it looks good.
The other thing I am trying to do while setting the width is to set the height of the popup. I am going to have either 4 or 5 rows and I want my users to see all the rows which will have photos used in a diagnosis and I don't want them to scroll but to see all choices at once.
in the popup_Opened event where we have the first row, I got the actual height and then multiplied it times the number of rows, but funny thing, the amount of rows visible shrunk from two and 1/3 rows to one row. How do I get the height of one row so that when I multiply it times the number of rows, I'll have all showing?
Thanks.
Rob, what you did was really very good, you got deep into handling low level objects and gave me visibility into the control I did not have. I'll try this and let you know how it goes.
Thanks for jumping on this.