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

SelectionBoxTemplate is not working

13 Answers 312 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Arun Kumar
Top achievements
Rank 2
Arun Kumar asked on 02 May 2011, 10:22 AM
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>

13 Answers, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 04 May 2011, 12:00 PM
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
0
Frank Wanicka
Top achievements
Rank 1
answered on 10 May 2011, 02:30 PM

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?
0
Yana
Telerik team
answered on 12 May 2011, 01:25 PM
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
0
Simon
Top achievements
Rank 1
answered on 12 Sep 2011, 06:18 AM
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. 
0
Yana
Telerik team
answered on 12 Sep 2011, 09:47 AM
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 >>

0
pradeep
Top achievements
Rank 1
answered on 13 Sep 2011, 07:29 PM
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.....

0
Yana
Telerik team
answered on 19 Sep 2011, 09:07 AM
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 >>

0
saw
Top achievements
Rank 1
answered on 02 Oct 2014, 12:21 PM
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 ? 
0
Kalin
Telerik team
answered on 02 Oct 2014, 01:35 PM
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.
 
0
Arnaud
Top achievements
Rank 1
answered on 14 May 2015, 01:31 PM

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.

 

0
Arnaud
Top achievements
Rank 1
answered on 14 May 2015, 01:35 PM

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.

0
Arnaud
Top achievements
Rank 1
answered on 14 May 2015, 01:38 PM

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.

0
Kalin
Telerik team
answered on 15 May 2015, 10:27 AM
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
Tags
ComboBox
Asked by
Arun Kumar
Top achievements
Rank 2
Answers by
Konstantina
Telerik team
Frank Wanicka
Top achievements
Rank 1
Yana
Telerik team
Simon
Top achievements
Rank 1
pradeep
Top achievements
Rank 1
saw
Top achievements
Rank 1
Kalin
Telerik team
Arnaud
Top achievements
Rank 1
Share this question
or