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

SelectionBoxTemplate not working of Combobox

1 Answer 97 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Md.Hasanuzzaman
Top achievements
Rank 1
Md.Hasanuzzaman asked on 16 Jun 2012, 06:43 PM
I am writing this lines of code 

  <telerik:RadComboBox Height="28" Margin="0,112.051,12,0" Grid.Row="1" VerticalAlignment="Top">
      <telerik:RadComboBox.SelectionBoxTemplate>
       <DataTemplate>
        <TextBlock Text="{Binding}" Foreground="Red"/>   
    </DataTemplate>   
   </telerik:RadComboBox.SelectionBoxTemplate>
      <telerik:RadComboBoxItem Content="Item 1"/>
      <telerik:RadComboBoxItem Content="Item 2"/>
      <telerik:RadComboBoxItem Content="Item 3"/>
     </telerik:RadComboBox>
But this is not working. Please tell me what i am doing worng ?
Thank you.

1 Answer, 1 is accepted

Sort by
0
Accepted
Vladi
Telerik team
answered on 18 Jun 2012, 11:46 AM
Hi Hasanuzzaman,

The RadComboBox control ignores the SelctionBoxTemplate property when there are statically declared RadComboBoxItem's and uses the ContentTemplate of the selected RadComboBoxItem. There are two solutions to this issue:

  1. To dynamically declare ComboBox items via bindings.
  2. Use <system:String> to statically declare content items. Here is a simple code representing that:
<telerik:RadComboBox
            SelectionBoxTemplate="{StaticResource SelectionBoxTemplate}"
           
            >
            <system:String>Item 1</system:String>
            <system:String>Item 2</system:String>
            <system:String>Item 3</system:String>
</telerik:RadComboBox>

Hope this helps.

All the best,
Vladi
the Telerik team

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

Tags
ComboBox
Asked by
Md.Hasanuzzaman
Top achievements
Rank 1
Answers by
Vladi
Telerik team
Share this question
or