Hi All,
I am trying to get an UltraDropDown to resize to the width of an UltraGrid column but have been unsuccesfull. The size of the drop down is always the size of the width property of the drop down control (i.e. 125).
The drop down is bound to a data source with a few columns, all of the columns are hidden except for one. I have the DropDownWidth set to -1 (have tried 0 and -2 but it makes no difference), and i also have the AutoFit Style as Resize All Columns.
The column in the grid using the drop down, has its ValueList set to the drop down i have created, and also has the Style property set to DropDown. I have also tried DropDownList no difference.
Is it possible to have the drop down control automatically resize itself to the column width in the grid, or do i need to do it manually (i.e. on initilize), and how would i go about doing this?
Thanks,
Nathan.
Hi,
You want to autosize the columns in the dropdown? The property way to do that would be to use:
ultraCombo.DisplayLayout.PerformAutoResizeColumns
If this is not working, then my guess is that it's an issue of timing or that you are specifying the wrong parameters. Make sure you tell it to include all rows (not just visible rows). And that the combo actually has rows at the time you are calling the method.
Hi Mike
The solution you suggested works to resize the width of combobox drop down rectangle
But the column inside of the DisplayLayout, again needs to resized manually (or programmatically)
Surprisingly the following does not work on ultracombo
ultraCombo.AutoFitStyle
ultraCombo.DisplayLayout.Override.AutoResizeColumnWidthOptions
Can clues?
Thank you!
Hi Mike,
Thanks for that, workaround works a treat.
Nathan
Hi Nathan,
Here's a quote from the documentation on the DropDownWidth property:
"A setting of 0 will cause the dropdown to auto-size itself to the width of the edit portion. In the case of the UltraCombo control, this is the width of the control. In the case of the UltraDropDown control, this will be the size of the editor in the column."
I just tested this out, though, and it does not seem to be working for me, either. So it looks like this is a bug. I'm forwarding this thread over to the our Developer Support group so they can write it up for developer review.
In the mean time, you can work around this using the BeforeCellListDropDown event. This code worked for me:
private void ultraGrid1_BeforeCellListDropDown(object sender, CancelableCellEventArgs e) { UltraDropDown udd = e.Cell.ValueListResolved as UltraDropDown; if (udd != null) udd.DropDownWidth = e.Cell.Column.CellSizeResolved.Width; }