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

Text alignment in editable ComboBox

3 Answers 92 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Roman Wack
Top achievements
Rank 1
Roman Wack asked on 05 Oct 2010, 03:23 PM
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

3 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 05 Oct 2010, 03:32 PM
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
0
Roman Wack
Top achievements
Rank 1
answered on 05 Oct 2010, 03:57 PM
Thank you.
That is solving my first problem. Do you have a solution for my second one?
0
George
Telerik team
answered on 08 Oct 2010, 03:18 PM
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
Tags
ComboBox
Asked by
Roman Wack
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Roman Wack
Top achievements
Rank 1
George
Telerik team
Share this question
or