开发者

How to add sub menus to the ContextMenu control in Silverlight 4?

I have the following piece of XAML code:

<controlsInputToolkit:ContextMenuService.ContextMenu>
    <controlsInputToolkit:ContextMenu
                        Height="75"                                
                        Width="200"                                
                        IsOpen="False"
                        Visibility="Collapsed"
                        Closed="mnuPopup_Closed"
                        x:Name="mnuPopup">

        <controlsInputToolkit:MenuItem
                            x:Name="mnuAnswer911Call"
                            Header="Answer Call"
                            Click="mnuAnswer911Call_Click"
 开发者_高级运维                           IsEnabled="True"/>

        <controlsInputToolkit:MenuItem
                            x:Name="mnuHangup911Call"
                            Header="Hangup call"
                            Click="mnuHangup911Call_Click"
                            IsEnabled="True"/>

    </controlsInputToolkit:ContextMenu>
</controlsInputToolkit:ContextMenuService.ContextMenu>

Let's say, based on context, I wanted to add a submenu to the mnuAnswer911Call menu item. How would I go about it?


The Silverlight Context Menu does not support submenus yet. But there are open source alternatives to help you achieve this. Here is one:

www.sl4popupmenu.codeplex.com

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜