I'm using 2016 Q1 (Jan) and am dynamically adding RadLabels to a user control. I have converted from .NET Label to RadLabel.
The user control fills a SplitPanel and is currently out of focus when the form first opens.
The form is always visible and is loaded before the RadLabels are dynamically added.
When dynamically adding the RadLabels they are each added to the user control, their text is set and then they are all adjusted and aligned to match the length of the RadLabel with the longest text. Well, that's how it used to work with the normal .NET Label...
Each RadLabel is set correctly but none ever resize to fit their text and instead are always 100 wide even though some should be over 200.
I've tried implementing the AutoSize to false, set text, AutoSize to true workaround but it never works. No combination of AutoSize makes any difference.
I cannot apply these changes in other place due to the nature of the code (plugins, etc.) so they must take effect here.
Is there a way to get the calculated size of the RadLabels and use that width? Is there a way to get the RadLabel to behave as expected?
This snippet takes place after the RadLabels have all been added to the user control and I need to get the longest width.
01.
Int32 loWidth = 0;
02.
03.
foreach
(RadLabel lpLabel
in
loLabels)
04.
{
05.
lpLabel.AutoSize =
false
;
06.
lpLabel.TextWrap =
false
;
07.
lpLabel.Text =
this
.getText();
08.
lpLabel.TextAlignment = ContentAlignment.MiddleRight;
09.
lpLabel.AutoSize =
true
;
10.
11.
if
(lpLabel.Width > loWidth)
12.
{
13.
loWidth = lpLabel.Width;
14.
}
15.
}