Need Left Horizontal Alignment in ComboBox When Text Extends Fixed Width

2 posts, 0 answers
  1. John
    John avatar
    18 posts
    Member since:
    Mar 2013

    Posted 27 Mar 2014 Link to this post

    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
  2. Kalin
    Kalin avatar
    1283 posts

    Posted 28 Mar 2014 Link to this post

    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.


    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.

Back to Top