如何防止RadMenu关闭鼠标右键单击

时间:2012-07-12 12:15:02

标签: wpf telerik contextmenu right-click radmenu

我在WPF应用程序中创建了RadMenu,并为RadMenuItems添加了一个上下文菜单。以下是RadMenu的代码/ XAML

<telerik:RadMenu Name="radMenu1" ItemsSource="{Binding MenuHeaders}" Height="76">
                <telerik:RadMenu.ItemTemplate>
                    <HierarchicalDataTemplate ItemsSource="{Binding Path=Children}">
                        <HierarchicalDataTemplate.ItemContainerStyle>
                            <Style TargetType="telerik:RadMenuItem">
                                <Setter Property="Command"
                            Value="{Binding Command}" />
                            </Style>
                        </HierarchicalDataTemplate.ItemContainerStyle>
                        <StackPanel Height="Auto">
                            <Image MaxWidth="32" MaxHeight="32" Source="{Binding mImage}" />
                            <TextBlock HorizontalAlignment="Center" Text="{Binding mText}"></TextBlock>
                            <Image MaxWidth="10" MaxHeight="10" HorizontalAlignment="Center" Source="{Binding mDownImage}" />
                        </StackPanel>
                    </HierarchicalDataTemplate>
                </telerik:RadMenu.ItemTemplate>
                <telerik:RadContextMenu.ContextMenu>
                    <telerik:RadContextMenu>
                            <telerik:RadMenuItem Header="Add to Wishlist">
                                <telerik:RadMenuItem.Icon>
                                    <Image Source="/WPFTestApp;component/Images/New.png" />
                                </telerik:RadMenuItem.Icon>
                            </telerik:RadMenuItem>
                    </telerik:RadContextMenu>
                </telerik:RadContextMenu.ContextMenu>
            </telerik:RadMenu>

ContextMenu工作正常但是当我右键单击任何RadMenuItem时,ContextMenu被打开但RadMenu被关闭。我想保持RadMenu开放,但不知道怎么做?

0 个答案:

没有答案