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

Need Left Horizontal Alignment in ComboBox When Text Extends Fixed Width

1 Answer 43 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 27 Mar 2014, 09:06 PM
It's recently been brought to my attention on a Silverlight application I work on, that when a RadComboBox is a fixed width and the character extend past that width, clicking off focus will make the text align on the left, but saving within the app, the text then aligns to the right.  I want it to remain aligned to the left instead of the left characters being cut off.

Some research revealed this is the intended behavior for RadComboBox.  How can I override this to make it align left.  I've tried applying HorizontalContentAlignment=Left on various levels--within styles on the resource files, likewise within Grid.Resources, etc.  No luck.  Likewise with HorizontalAlignment.

What is the proper solution?  Is textclipping and ellipsis the proper way to go?  If so, what's the best solution?  I would prefer to do this on a resource level.


Thank you kindly,
John Gnotek

1 Answer, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 28 Mar 2014, 12:10 PM
Hello John,

You can achieve the desired by handling the Loaded event of the required ComboBox. In the handler you will need to get the TextBox with name PART_EditableTextBox from the Template of the ComboBox and set its SelectionStart and SelectionLength properties to 0. Please check the attached sample project which demonstrates the exact approach.

Hope this will work for you.

Regards,
Kalin
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
ComboBox
Asked by
John
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or