This question is locked. New answers and comments are not allowed.
Hi,
I'm having some display issues with menu items inside a RadContextMenu, which is assigned as the drop down content of a RadDropDownButton.
The menu items are displayed using a DataTemplate set as the ItemTemplate of the RadContextMenu, but this generates a weird inner border effect around each of the RadMenuItems, as if they were contained in an outer RadMenuItem or something similar.
If I just use a TextBlock inside the DataTemplate then the inner border effect goes away, but I lose the ability to associate a command and a command parameter.
Can you recommend a way of fixing this so that the behaviour is the same, but the inner border disappears?
Here's the XAML and C# code that illustrates the problem:
Thanks!
I'm having some display issues with menu items inside a RadContextMenu, which is assigned as the drop down content of a RadDropDownButton.
The menu items are displayed using a DataTemplate set as the ItemTemplate of the RadContextMenu, but this generates a weird inner border effect around each of the RadMenuItems, as if they were contained in an outer RadMenuItem or something similar.
If I just use a TextBlock inside the DataTemplate then the inner border effect goes away, but I lose the ability to associate a command and a command parameter.
Can you recommend a way of fixing this so that the behaviour is the same, but the inner border disappears?
Here's the XAML and C# code that illustrates the problem:
<UserControl x:Name="myControl" x:Class="RadComboBoxProblem.MainPage" xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation" <Grid x:Name="LayoutRoot" Background="White"> <Grid.ColumnDefinitions> <ColumnDefinition Width="200" /> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="50" /> </Grid.RowDefinitions> <telerik:RadDropDownButton x:Name="NewInstrumentDropDownButton"> <telerik:RadDropDownButton.Content> <TextBlock Text="New Object" Margin="2,0,0,0" /> </telerik:RadDropDownButton.Content> <telerik:RadDropDownButton.DropDownContent> <telerik:RadContextMenu ItemsSource="{Binding AvailableObjectTypes}" > <i:Interaction.Triggers> <i:EventTrigger EventName="ItemClick"> <ei:ChangePropertyAction TargetName="NewInstrumentDropDownButton" PropertyName="IsOpen" Value="false" /> </i:EventTrigger> </i:Interaction.Triggers> <telerik:RadContextMenu.ItemTemplate> <DataTemplate> <telerik:RadMenuItem Header="{Binding}" Command="{Binding ElementName=myControl, Path=ViewModel.AddCommand}" CommandParameter="{Binding}" /> </DataTemplate> </telerik:RadContextMenu.ItemTemplate> </telerik:RadContextMenu> </telerik:RadDropDownButton.DropDownContent> </telerik:RadDropDownButton> </Grid></UserControl>using System.Collections.ObjectModel;using System.ComponentModel;using System.Windows;using System.Windows.Input;using Microsoft.Expression.Interactivity.Core;namespace RadComboBoxProblem{ public partial class MainPage { public MainPage() { DataContext = new ViewModel(); InitializeComponent(); } public ViewModel ViewModel { get { return (ViewModel)DataContext; } } } public class ViewModel : INotifyPropertyChanged { public ViewModel() { AddCommand = new ActionCommand(type => MessageBox.Show((string)type)); } public ICommand AddCommand { get; private set; } public ObservableCollection<string> AvailableObjectTypes { get { return new ObservableCollection<string> { "Apple", "Pear", "Orange" }; } } public event PropertyChangedEventHandler PropertyChanged; }}Thanks!