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

Hard to select RadMenuItem in RadComboBox

1 Answer 185 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
carlos
Top achievements
Rank 1
carlos asked on 03 Aug 2015, 08:06 AM

I add RadMenuItem inside RadComboBox as below code & screenshot, however, there are 2 borders in the dropdownitem when i selected( please refer to the screenshot-> Red Category), and i can't select the dropdownitem when i click the text in the inner border. It only can be selected by click the outer border. please help to advise. thanks.

 

 

<telerik:RadComboBox  ItemsSource="{Binding Categories}" SelectedItem="{Binding Occurrence.Appointment.Category, Mode=TwoWay}"  Width="136" MinHeight="22"   BorderThickness="0" HorizontalContentAlignment="Left" DisplayMemberPath="CategoryName">
     <telerik:RadComboBox.ItemTemplate>
            <DataTemplate>
                 <telerik:RadMenuItem>
                        <telerik:RadMenuItem.Header>
                          <TextBlock Text="{Binding CategoryName}"></TextBlock>
                         </telerik:RadMenuItem.Header>
                        <telerik:RadMenuItem.Icon>
                               <Rectangle Width="14" Height="14"  HorizontalAlignment="Left" VerticalAlignment="Center" Fill="{Binding CategoryBrush}" />
                       </telerik:RadMenuItem.Icon>
                  </telerik:RadMenuItem>
             </DataTemplate>
       </telerik:RadComboBox.ItemTemplate>
</telerik:RadComboBox>

1 Answer, 1 is accepted

Sort by
0
Nasko
Telerik team
answered on 05 Aug 2015, 01:41 PM
Hello Carlos,

The observed by you behavior is an expected one as you are actually clicking on the RadMenuItem not on the RadComboBoxItem - thus no item is selected. What we could suggest you in order to achieve the desired functionality and behavior is to handle the Click event of the MenuItem. Inside the implementation of the event to get DataContext of the clicked MenuItem which represents the item you like to select and set the SelectedItem property of RadComboBox with it.

We have created a sample project that demonstrates the described above approach and you could run and evaluate it.

Hopes this helps.

Regards,
Nasko
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
carlos
Top achievements
Rank 1
Answers by
Nasko
Telerik team
Share this question
or