Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
213
UltraDropDown Resize to UltraGrid Column Width
posted

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.

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    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;
            }

     

Children