This is a mirror of official site: http://jasper-net.blogspot.com/

Menu and Context Menu for Silverlight 4.0

| Sunday, July 10, 2011
Context menu and hierachical menu for Silverlight 4.0

This project started out after I found nothing in the Silverlight open source community that would allow me to use the popup control in a straightforward manner. It is now a fully fledged multilevel menu with support for templating, commanding and many other goodies. I tried to make it as flexible as possible to answer the needs of most Silverlight developers out there while keeping it under 30K(zipped).

Click here to view a demo on the general capabilities of the control in handling shortcut, access keys(try Ctrl+Alt+M), left click, right click and hover events.

In short here is what you get:

    Nested Menus
    Pinnable Menus
    Boundary Detection
    Animations
    Keyboard Navigation
    Shortcuts and Access Keys
    Data Binding
    Command Support
    Vertical Menu Orientation
    Context Menu
    Styling
    Use Existing Themes
    Scrollable
    Three State Checkbox
    Item Template
    Reusability

Just put an ItemsControl such as a ListBox inside it, specify the name(s) of the trigger control(s) and your menu is ready to fly when you left click, right click or hover the latter.

Any derivative a the ItemsControl like the Treeview can be used as template. However when no control is specified an auto-generated ListBox is used by default.
In the example below a menu consisting of a few menu items and a submenu will popup when the shortcut Ctrl+Alt+M is pressed or when Button1 is right or left clicked:

    <Button Name="Button1" Height="50"/>
    <my:PopupMenu RightClickElements="Button1" LeftClickElements="Button1" AccessShortcut="Ctrl+Alt+M">
        <ListBox>
            <my:PopupMenuItem Header="Menu1" />
            <my:PopupMenuSeparator />
            <my:PopupMenuItem Header="SubMenuHeader1" ImageRightSource="images/arrow.png">
                <my:PopupMenu>
                    <ListBox>
                        <my:PopupMenuItem Header="SubMenu1" />
                    </ListBox>
                </my:PopupMenu>
            </my:PopupMenuItem>
            <my:PopupMenuItem Header="Menu2" />
            <my:PopupMenuItem Header="Menu3" />
        </ListBox>
    </my:PopupMenu>


Read more: Codeplex
QR: https://chart.googleapis.com/chart?chs=80x80&cht=qr&choe=UTF-8&chl=http://sl4popupmenu.codeplex.com/

Posted via email from Jasper-net

0 comments: