This is a migrated thread and some comments may be shown as answers.

Why RadDropdownlist for Winform changes the TextAlignment to center automatically?

2 Answers 208 Views
DropDownList
This is a migrated thread and some comments may be shown as answers.
Phuong
Top achievements
Rank 1
Phuong asked on 10 Jan 2017, 08:23 AM

Hello everyone, 

I tried to use the RadDropdownlist in my our project based on Winform, but when i changed the SelectedIndex there is an issue happened, it changed the TextAlignment to center automatically?

Although i tried many solutions to fix it but i cannot, so please help me to solve this issue :(

Bellow are my code, it happened on two bold lines.

var ddl = control as RadDropDownList;
if (ddl != null)
{
    if (!string.IsNullOrWhiteSpace(value))
    {
        var selectedItem = ddl.Items.FirstOrDefault(x => x.Value != null && x.Value.ToString() == value);
        if (selectedItem != null)
        {
            ddl.SelectedItem = selectedItem;
        }
    }
    else
    {
        ddl.SelectedIndex = -1;
        ddl.Text = $"Select {childField.FieldName}";
    }
}
else
{
    var maskedBox = control as MarsMaskedEditBox;
    if (maskedBox != null)
    {
        maskedBox.Value = value;
    }
    else
    {
        control.Text = value;
    }
}

2 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 10 Jan 2017, 08:55 AM
Hi Phuong,

Thank you for writing.

This is a known issue which is logged in our Feedback Portal. The issue is now resolved and the fix will be available in the next official release. The issue details along with a workaround are available here: FIX. RadDropDownList - the TextAlignment is reset when one is setting the text of the DropDownList

I hope this information is useful. Let me know if you need further assistance.

Regards,
Dimitar
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Phuong
Top achievements
Rank 1
answered on 10 Jan 2017, 10:04 AM

Hi Dimitar,

Your information very helpful for me, it solved my code issue.

Thanks you very much for your help :)

Tags
DropDownList
Asked by
Phuong
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Phuong
Top achievements
Rank 1
Share this question
or