UltraDropDown Resize to UltraGrid Column Width

rated by 0 users
Answered (Verified) This post has 1 verified answer | 2 Replies | 1 Follower

Not Ranked
Points 110
Nathan2009 posted on 04-01-2009 10:57 PM

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.

Answered (Verified) Verified Answer
Top 10 Contributor
Points 237,030
Infragistics Employee

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

 

Mike Saltzman

Windows Forms Development Team Lead

Infragistics, Inc.

  • | Post Points: 20
All Replies
Top 10 Contributor
Points 237,030
Infragistics Employee

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

 

Mike Saltzman

Windows Forms Development Team Lead

Infragistics, Inc.

  • | Post Points: 20
Not Ranked
Points 110

Hi Mike,

Thanks for that, workaround works a treat.

Thanks,

Nathan

  • | Post Points: 5
Page 1 of 1 (3 items) | RSS

Forum Statistics

40,788 users have contributed to 129,818 threads and 144,150 posts.

In the past week, we've had 5,582 new users, adding to our total of 467,627 registered users!

In the past 24 hours, we have 56 new thread(s), 217 new post(s), and

In the past 3 days, the most popular thread for everyone has been "Google Chrome & UltraWebGrid. Compatible or Not? ". The post with the most views is "In wingrid RowFilter dropdown items for DropDown column is not shwing ". The most replies were made to "Google Chrome & UltraWebGrid. Compatible or Not? ".

Please welcome our newest member fceskxv .