Text alignment in editable ComboBox

4 posts, 0 answers
  1. Roman Wack
    Roman Wack avatar
    13 posts
    Member since:
    Mar 2010

    Posted 05 Oct 2010 Link to this post

    I have an editable combobox. I set the HorizontalContentAlignment to left.
    If the ComboBoxItem is short enough to fit into the box, The Item is left aligned. But if the item text is longer than the combobox, The end of the text is shown an the beginning is cut off.
    It is also possible that the last letters that fit into the combobox are replaced by ...?
    So that something like this is shown: "Very long en..." instead of "Very long en" for a string like "very long entry"?

    Thank you
  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 05 Oct 2010 Link to this post

    Hi,

    The scrolling occurs because RadComboBox selects the text of its inner TextBox on certain events. You could prevent this selection by setting the SelectAllTextEvent property. This should leave the item text left aligned.

    All the best,
    Valeri Hristov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. DevCraft banner
  4. Roman Wack
    Roman Wack avatar
    13 posts
    Member since:
    Mar 2010

    Posted 05 Oct 2010 Link to this post

    Thank you.
    That is solving my first problem. Do you have a solution for my second one?
  5. George
    Admin
    George avatar
    1332 posts

    Posted 08 Oct 2010 Link to this post

    Hello Roman,

    Unfortunately, we don't support such a feature for RadComboBox out of the box.
    In order to accomplish this, I would suggest you to set ItemTemplate for the RadComboBox control. In the DataTemplate you could place a TextBlock and set the TextTrimming="WordEllipsis" property of the TextBlock control. For example:

    <telerik:RadComboBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock TextTrimming="WordEllipsis" Text="{Binding}" MaxWidth="200"/>
                    </DataTemplate>
                </telerik:RadComboBox.ItemTemplate>

    I hope this suits your needs. 
     


    All the best,
    George
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Back to Top