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

Textwrapping in Combo box

3 Answers 78 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
kannan
Top achievements
Rank 1
kannan asked on 25 Oct 2010, 12:33 PM
Hi,
     i am using RadCombo Box.i have to set  multiline with textwrapping property for combo box items ..if the size of the item greater then combo box width , the text have to wrap to the  next line.
 also i am using SelectionBoxTemplate inside

telerik

 

 

:RadWindow.Resources

 

..But this is not working.. when i run the application SelectionBoxTemplate is null.....
How  to set ? 
This is my code;

 

 

 

<telerik:RadComboBox.ItemsPanel>

 

 

 

 

 

 

<ItemsPanelTemplate>

 

 

 

 

 

 

 

<StackPanel HorizontalAlignment="Left" Orientation="Vertical" ScrollViewer.HorizontalScrollBarVisibility="Auto" ScrollViewer.VerticalScrollBarVisibility="Auto" Width="568">

 

 

 

 

 

 

</StackPanel>

 

 

 

 

 

 

</ItemsPanelTemplate>

 

 

 

 

 

 

</telerik:RadComboBox.ItemsPanel>

 

 

 

3 Answers, 1 is accepted

Sort by
0
Yana
Telerik team
answered on 28 Oct 2010, 12:00 PM
Hello kannan,

You should set ItemTemplate property of the combobox in order to wrap the text of its items. I've attached a simple example to demonstrate how to set both ItemTemplate and SelectionBoxTemplate, please download it and give it a try.

All the best,
Yana
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
black
Top achievements
Rank 1
answered on 24 Mar 2014, 01:43 PM
Hi Yana,

         I also try to bind Key value pair to Rad Combo Box Control with Item Template.
 but Rad control display  value of item. but i want to show value instead of Key.

Sample Code

<telerik:RadComboBox MinHeight="34" MaxHeight="52"  HorizontalAlignment="Left" Name="CmbHired" TabIndex="7" Grid.Row="3" Grid.Column="1" ItemsSource="{Binding HiredProductCollection}"  SelectedValuePath="Id" SelectedValue="{Binding HiredProductGuid,Mode=TwoWay}" >
                                                                <i:Interaction.Triggers>
                                                                    <i:EventTrigger EventName="SelectionChanged">
                                                                        <i:InvokeCommandAction Command="{Binding HiredProductSelectionChangedCommand}" CommandParameter="{Binding SelectedItem, ElementName=CmbHired}"/>
                                                                    </i:EventTrigger>
                                                                </i:Interaction.Triggers>
                                                                <telerik:RadComboBox.ItemTemplate>
                                                                    <DataTemplate>
                                                                        <Grid Width="172" >
                                                                            <TextBlock  Style="{x:Null}" Foreground="#2B3856" Padding="2" TextWrapping="Wrap" TextAlignment="Left" Width="172" Text="{Binding}" />
                                                                        </Grid>
                                                                    </DataTemplate>
                                                                </telerik:RadComboBox.ItemTemplate>
                                                            </telerik:RadComboBox>

But it's showing only values.
0
black
Top achievements
Rank 1
answered on 24 Mar 2014, 02:16 PM
i have solve the issues. i got solution form Telerik Demo URL.

http://demos.telerik.com/silverlight/#ComboBox/DataBinding

Solution is telerik:TextSearch.TextPath="Name"

Thanks Yana
Tags
ComboBox
Asked by
kannan
Top achievements
Rank 1
Answers by
Yana
Telerik team
black
Top achievements
Rank 1
Share this question
or