RadComboBox - Use "SelectionBoxTemplate", "ItemTemplate" and "TextSearch.TextPath" properties?

13 posts, 0 answers
  1. Rob
    Rob avatar
    238 posts
    Member since:
    Jan 2009

    Posted 28 Apr 2010 Link to this post

    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.
  2. Valeri Hristov
    Admin
    Valeri Hristov avatar
    2252 posts

    Posted 03 May 2010 Link to this post

    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.
  3. DevCraft banner
  4. Dan Andrews
    Dan Andrews avatar
    28 posts
    Member since:
    Jul 2009

    Posted 18 Jan 2011 Link to this post

    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.
  5. Dan Andrews
    Dan Andrews avatar
    28 posts
    Member since:
    Jul 2009

    Posted 18 Jan 2011 Link to this post

    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.
  6. Pana
    Admin
    Pana avatar
    748 posts

    Posted 25 Jan 2011 Link to this post

    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>>
  7. Dan Andrews
    Dan Andrews avatar
    28 posts
    Member since:
    Jul 2009

    Posted 25 Jan 2011 Link to this post

    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.
  8. George
    Admin
    George avatar
    1332 posts

    Posted 31 Jan 2011 Link to this post

    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>>
  9. Dan Andrews
    Dan Andrews avatar
    28 posts
    Member since:
    Jul 2009

    Posted 31 Jan 2011 Link to this post

    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.
  10. Dave Swersky
    Dave Swersky avatar
    5 posts
    Member since:
    Apr 2010

    Posted 05 Feb 2011 Link to this post

    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.  
  11. Dave Swersky
    Dave Swersky avatar
    5 posts
    Member since:
    Apr 2010

    Posted 05 Feb 2011 Link to this post

    A hack- override ToString() on the objects you're populating
  12. Mike
    Mike avatar
    39 posts
    Member since:
    May 2011

    Posted 07 Jul 2011 Link to this post

    Hi!

    I need this behaviour as well, is there a chance to implement it in a future release?
    greetings
    Michael
  13. Dan Andrews
    Dan Andrews avatar
    28 posts
    Member since:
    Jul 2009

    Posted 07 Jul 2011 Link to this post

    Please see my last post.  It works, but it's not obvious.
  14. Pana
    Admin
    Pana avatar
    748 posts

    Posted 14 Jul 2011 Link to this post

    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>>
Back to Top
DevCraft banner