SelectionBoxTemplate is not working

14 posts, 0 answers
  1. Arun Kumar
    Arun Kumar avatar
    60 posts
    Member since:
    Nov 2009

    Posted 02 May 2011 Link to this post

    I am using ItemTemplate and SelectionBoxTemplate in RadCombobox. ItemTemplate is showing as expected
    but the selectionboxitem is showing EntityName:EntityKey format (UserEntity:1020 like this.)
    This is the markup i am using:

    <
    telerik:RadComboBox VerticalAlignment="Center" IsEditable="True" IsReadOnly="True"
                                              TextSearchMode="StartsWith" IsFilteringEnabled="True"
                                              ItemsSource="{Binding Path=NewPreference.LstSalesPerson}"
                                              SelectedValue="{Binding Path=NewPreference.ReferedTo, Mode=TwoWay}"
                                              SelectedValuePath="Username">
                                <telerik:RadComboBox.SelectionBoxTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <TextBlock Text="{Binding Path=Name}" VerticalAlignment="Center" FontWeight="Bold" />
                                        </Grid>
                                    </DataTemplate>
                                </telerik:RadComboBox.SelectionBoxTemplate>
                                <telerik:RadComboBox.ItemTemplate>
                                    <DataTemplate>
                                        <Grid>
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="27"/>
                                                <RowDefinition Height="Auto"/>
                                                <RowDefinition Height="Auto"/>
                                                <RowDefinition Height="Auto"/>
                                            </Grid.RowDefinitions>
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="100" />
                                                <ColumnDefinition MinWidth="100" Width="Auto" />
                                            </Grid.ColumnDefinitions>
     
                                            <TextBlock Text="{Binding Path=Name}" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2"
                                                       VerticalAlignment="Top" HorizontalAlignment="Stretch" FontWeight="Bold" Margin="0,2" />
     
                                            <TextBlock Text="{Binding Path=PhoneNo, Converter={StaticResource zeroConverter}}" Grid.Row="1" Grid.Column="0"
                                                       VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="0,3" />
     
                                            <TextBlock Text="{Binding Path=MobileNo, Converter={StaticResource zeroConverter}}" Grid.Row="1" Grid.Column="1"
                                                       VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="0,3" />
     
                                            <TextBlock Text="{Binding Path=Email, Converter={StaticResource zeroConverter}}" Grid.Row="2" Grid.Column="0"
                                                       Grid.ColumnSpan="2" VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="0,3" />
     
                                            <TextBlock Text="Last Assigned" Grid.Row="3" Grid.Column="0"
                                                       VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="0,3" />
                                            <TextBlock Text="{Binding Path=LastActivity, StringFormat='dd-MMM-yyyy HH:mm'}" Grid.Row="3" Grid.Column="1"
                                                       VerticalAlignment="Center" HorizontalAlignment="Stretch" Margin="0,3" />
                                        </Grid>
                                    </DataTemplate>
                                </telerik:RadComboBox.ItemTemplate>
                            </telerik:RadComboBox>

  2. Konstantina
    Admin
    Konstantina avatar
    2332 posts

    Posted 04 May 2011 Link to this post

    Hello Arun,

    The SelectionBoxTemplate is applied only to an non-editable ComboBox. The SelectedValuePath and SelectedValue properties should be enough to display the proper value in the TextBox of the ComboBox. You can read more about them in this help article.

    Please let us know if you have further questions.

    Greetings,
    Konstantina
    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. Frank Wanicka
    Frank Wanicka avatar
    20 posts
    Member since:
    Jun 2010

    Posted 10 May 2011 Link to this post

    How about if you want to display more than one field in the selected item box? For example, i can do the following in an item template:

    <telerikInput:RadComboBox.ItemTemplate>
        <DataTemplate>
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="{Binding Name, Mode=OneWay}" />
                <TextBlock Text=" (" />
                <TextBlock Text="{Binding CompanyCode, Mode=OneWay}" />
                <TextBlock Text=")" />
            </StackPanel>
        </DataTemplate>
    </telerikInput:RadComboBox.ItemTemplate>

    How do I get the same formatting in the selection box?
  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 12 May 2011 Link to this post

    Hello Frank,

    Please check out this help article - it explains how to use SelectionBoxTemplate.  Try it and if you have any additional issues, write to us again.

    Best wishes,
    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
  6. Simon
    Simon avatar
    47 posts
    Member since:
    May 2008

    Posted 12 Sep 2011 Link to this post

    The SelectionBoxTemplate is applied only to an non-editable ComboBox. 

    It would have been really helpful if this was in the online help - save me and others heaps of time. 
  7. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 12 Sep 2011 Link to this post

    Hi Simon,

    You are right, we will include it in the article. Thank you for the feedback.

    Kind regards,
    Yana
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

  8. pradeep
    pradeep avatar
    1 posts
    Member since:
    Sep 2011

    Posted 13 Sep 2011 Link to this post

    Hey this is pradeep... My question is not just abt the SelectionBox Template  but i am using a radcombobox as a Autocomplete dropdown list in my project. i am using and item template which had two text boxes. the combobox loads just fine with all the data but i can not see the selscted item once i have selcted the item or used the Autocomplete feature.....  

     

    <telerik:RadComboBox Name="ddlDocument"

     ItemsSource="{Binding Path=Filing.Documents}"

     IsReadOnly="True"

     Width="145"

     MinHeight="20"

     IsEditable="True"

     TextInputStart="ddlDocument_TextInputStart">

     <telerik:RadComboBox.ItemTemplate>

     <DataTemplate>

     <StackPanel>

     <StackPanel Orientation="Horizontal">

     <TextBlock Width="Auto" Text="{Binding Path=Caption}" VerticalAlignment="Center" />

     <TextBlock Text="(" />

     <TextBlock Text="{Binding Path= DocketCode.Code}" HorizontalAlignment="Right" VerticalAlignment="Center" />

     <TextBlock Text=")" />

     </StackPanel>

     </StackPanel>

     </DataTemplate>

     </telerik:RadComboBox.ItemTemplate>

     
    As i said i have also tried the selection box template i want use the autocomplete feature for either the "Code" or the "Caption" from the above code. can u please direct me to any similar sample you have or you can feel free to correct/add code to the above sample.....

  9. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 19 Sep 2011 Link to this post

    Hi Pradeep,

    You should also set SelectedValuePath and  telerik:TextSearch.TextPath properties to the field that should be shown in the combobox input:

    <telerik:RadComboBox Name="ddlDocument"
            SelectedValuePath="Caption"
            telerik:TextSearch.TextPath="Caption"
              ...      >

    All the best,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  10. saw
    saw avatar
    29 posts
    Member since:
    Jun 2014

    Posted 02 Oct 2014 Link to this post

    Hi,
    This is my combo box,

    <telerik:RadComboBox x:Name="cmbTags" ItemsSource="{Binding Tags_CustmFldDetails.TagsList,Mode=TwoWay}" SelectedIndex="0" IsReadOnly="False" SelectedItem="{Binding Tags_CustmFldDetails.SelectedTag, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"  HorizontalAlignment="Left"  Width="188" VerticalAlignment="Top"   Margin="115,42,0,0" Height="23">
                            <telerik:RadComboBox.ItemTemplate>
                                <DataTemplate >
                                    <TextBox Text="{Binding TagName,Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}" HorizontalAlignment="Left" Width="100"/>
                                </DataTemplate>
                            </telerik:RadComboBox.ItemTemplate>
                        </telerik:RadComboBox>

    I have Observable collection call "TagsList" and property for selected item, all bindings work fine.
    When i select 1st item in drop down it get show in combo box, Problem is, if expand drop down and edit same item and select it again those changes will not be display on combo box ? 
  11. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 02 Oct 2014 Link to this post

    Hi Saw,

    Can you share how exactly do you edit the item - in the code? However in order to notify the UI when modifying properties in the code, you would need to implement INotifyPropertyChanged interface in your custom object class as shown in the following article:
    http://msdn.microsoft.com/en-us/library/vstudio/ms229614%28v=vs.100%29.aspx

    Hope this helps.

    Regards,
    Kalin
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  12. Arnaud
    Arnaud avatar
    17 posts
    Member since:
    Mar 2013

    Posted 14 May 2015 in reply to Yana Link to this post

    Hello,

    "The SelectionBoxTemplate is applied only to an non-editable ComboBox. "

    4 years later, and still not included it in the help article !!!!!

    I lost one hour finding out what was wrong ... 

     

    Arnaud.

     

  13. Arnaud
    Arnaud avatar
    17 posts
    Member since:
    Mar 2013

    Posted 14 May 2015 in reply to Konstantina Link to this post

    Ok now i've in mind that: The SelectionBoxTemplate is applied only to an non-editable ComboBox, could yould please help me changing the FontStyle of the edition/selection element without using this feature ?

    Best regards,

    Arnaud.

  14. Arnaud
    Arnaud avatar
    17 posts
    Member since:
    Mar 2013

    Posted 14 May 2015 in reply to Konstantina Link to this post

    As said here: The SelectionBoxTemplate is applied only to an non-editable ComboBox. But then how could we change, for example, the FontSyle of the edition/selection element  with IsEditable="True" ?

     

    Best Regards,

    Arnaud.

  15. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 15 May 2015 Link to this post

    Hello Arnaud,

    Thanks for the feedback and I apologize for the inconvenience - we will include it as soon possible. As for your question - you can use the TextBoxStyle property in order to apply a custom TextBox style for the input part of the control.

    Hope this helps.

    Regards,
    Kalin
    Telerik
    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 Feedback Portal and vote to affect the priority of the items
Back to Top
DevCraft banner