This is a migrated thread and some comments may be shown as answers.
RadComboBox - Use "SelectionBoxTemplate", "ItemTemplate" and "TextSearch.TextPath" properties?
12 Answers 333 Views
This is a migrated thread and some comments may be shown as answers.
Rob
Top achievements
Rank 1
Rob asked on 28 Apr 2010, 09:41 PM
Hello,

I am trying to use a RadComboBox with all these properties set:
<telerik:RadComboBox  
    ItemsSource="{Binding TheList, Source={StaticResource DataSource}}" 
    SelectionBoxTemplate="{StaticResource dt_SelectionBoxTemplate}" 
    ItemTemplate="{StaticResource dt_ItemTemplate}" 
    telerik:TextSearch.TextPath="Name" 
    IsEditable="True" 
    IsReadOnly="True" 
/>

My intent is to have an auto-completable (using the "Name" property of my data object) combobox that has one template for the selected item, and another template for the listed items.  Unfortunately, when I set the "telerik:TextSearch.TextPath" and "IsEditable" properties, it seems to ignore the SelectedBoxTemplate property...

Thoughts on how I might accomplish this or if the properties will be able to co-exist in the future?

Thanks.

12 Answers, 1 is accepted

Sort by
0
Valeri Hristov
Telerik team
answered on 03 May 2010, 11:47 AM
Hello Rob,

You are correct - when IsEditable = true, the SelectionBoxTemplate is ignored because the control displays a TextBox at the same place.

Regards,
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
Dan Andrews
Top achievements
Rank 2
answered on 18 Jan 2011, 10:08 PM
Since the template is ignored, how can we style the textbox that replaces it.  For instance, I'd like to set the HorizontalContentAlignment to Left.
0
Dan Andrews
Top achievements
Rank 2
answered on 18 Jan 2011, 10:40 PM
Just for clarification:
<t:RadComboBox Name="KAGSubsidiaryComboBox" Margin="0,1" 
                   t:TextSearch.TextPath="Name"
                   SelectedValuePath="Code" 
                   SelectedValue="{Binding Path=Entity, Mode=TwoWay, NotifyOnValidationError=True}"
                   IsEditable="True"                          
                   Grid.Column="1" 
                   Grid.Row="4" TabIndex="7" Height="24" >
        <t:RadComboBox.ItemTemplate>
            <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <TextBlock FontWeight="Bold" Text="{Binding Path=Code}" />
                <TextBlock Text=": " />
                <TextBlock Text="{Binding Path=Name}" />
                </StackPanel>
            </DataTemplate>
        </t:RadComboBox.ItemTemplate>
    </t:RadComboBox>

But if the "Name" is wider than the RadComboBox, then it alligns the text to the right.
0
Pana
Telerik team
answered on 25 Jan 2011, 07:35 AM
Hi Rob,

I am sorry for the delayed reply.

Note that the template has nothing to do with our RadComboBox:

<Border HorizontalAlignment="Left">
    <StackPanel HorizontalAlignment="Right" Orientation="Horizontal">
        <TextBlock Text="asda asd fasdf asd sdasd" />
        <TextBlock Text=": " />
        <TextBlock Text="asda sasdf asd fas fasfd dasd !!!" />
    </StackPanel>
</Border>

This should keep the text left aligned if there is enough space and right aligned if the text starts to clip. I would recommend you also to put Transparent background and a tooltip on the outer border so the users can read the whole thing when it is clipped.

Best wishes,
Pana
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Dan Andrews
Top achievements
Rank 2
answered on 25 Jan 2011, 02:19 PM
Thank you for the response.  Please find attached of the formatting that I have vs the formatting that I'd like.  Changing the content alignment etc doesn't appear to help me.
0
George
Telerik team
answered on 31 Jan 2011, 09:51 AM
Hello Dan,

 
Please, refer to the following link in our online documentation - http://www.telerik.com/help/silverlight/radcombobox-how-to-align-to-the-left-the-text-of-the-comboboxitem-when-it-is-too-long2.html

I hope this suits your needs.

All the best,
George
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
0
Dan Andrews
Top achievements
Rank 2
answered on 31 Jan 2011, 02:53 PM
I've read that before, but what is concerning is:  "To make it left aligned and remove the selection you can set the SelectAllTextEvent property of the ComboBox to None"

I don't want to remove the selection, my selected item should remain.  I'll try it.

--------------------------------------------

Yep, it worked... this method is less than intutive.
0
Dave Swersky
Top achievements
Rank 1
answered on 05 Feb 2011, 09:24 PM
Does this mean it's not possible to style the displayed/selected element in an editable combobox?  I have a form where this would be ideal, I really need to be able to display a selected value AND allow the user to type-search for a new value.  
0
Dave Swersky
Top achievements
Rank 1
answered on 05 Feb 2011, 10:03 PM
A hack- override ToString() on the objects you're populating
0
Mike
Top achievements
Rank 2
answered on 07 Jul 2011, 03:57 PM
Hi!

I need this behaviour as well, is there a chance to implement it in a future release?
greetings
Michael
0
Dan Andrews
Top achievements
Rank 2
answered on 07 Jul 2011, 08:31 PM
Please see my last post.  It works, but it's not obvious.
0
Pana
Telerik team
answered on 14 Jul 2011, 07:31 AM
Hello,

OK, I hope Dan Andrews post would help. Meanwhile I have created a PITS item for the SelectionBox template in IsEditable = True mode.

Kind regards,
Pana
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Asked by
Rob
Top achievements
Rank 1
Answers by
Valeri Hristov
Telerik team
Dan Andrews
Top achievements
Rank 2
Pana
Telerik team
George
Telerik team
Dave Swersky
Top achievements
Rank 1
Mike
Top achievements
Rank 2
Share this question
or