Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 84751

Dynamic RadDropDownList has incorrect Bottom and Height value when AutoSize = true

$
0
0

I've updated your example.
With AutoSize = true, if you set the Anchor property to include AnchorStyles.Right then .Height (and .Bottom) are broken.
With AutoSize = false, if you set the Anchor property to include AnchorStyles.Right then .Height (and .Bottom) are perfect.
I've changed my current solution to set AutoSize to false so I can properly evaluate the values (since I do the layout calculations last and all setting, including anchors, is done first). An alternative would be to always set anchors last.

I cannot attach anything other than images but if you change the click handler to this snippet you will achieve the same behaviour.

01.privatevoidradButton1_Click(objectsender, EventArgs e)
02.        {
03.            RadDropDownList ddl = newRadDropDownList();
04.            //ddl.AutoSize = false;
05.            ddl.Anchor = AnchorStyles.Left | AnchorStyles.Top | AnchorStyles.Right;
06.            this.splitPanel1.Controls.Add(ddl);
07. 
08.            if(ddl.Height == 0) MessageBox.Show(String.Format("AH! This isn't good! Bottom: {0}, Height: {1}", ddl.Bottom, ddl.Height));
09. 
10.            RadDropDownList ddl2 = newRadDropDownList();
11.            ddl2.Top = ddl.Bottom + 6;
12.            this.splitPanel1.Controls.Add(ddl2);
13.        }

Viewing all articles
Browse latest Browse all 84751

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>