Telerik blogs

The Q3 release is fast approaching and we are happy to announce that our control suite for Windows Phone will be updated with the addition of RadContextMenu. Our menu will provide a similar experience to the native OS context menu but will also provide a few extra goods that you won't find in other competitors. For example users will have an easy way of specifying which element should pop out when the context menu is set on a list box for example. The menu is set on the listbox itself, but the individual list box items will pop out when the menu is open. This will allow users to execute menu commands for the relevant list box item.

Here is a screenshot of this feature, notice how the list box item that the context menu is relevant to, pops out while the rest of the UI sinks in the background:

context menu focused element

No code or xaml is required for this to work with RadDataBoundListBox and RadJumpList. If you want to do this for the standard ListBox control however, all you need to do is to set the FocusedElementType attached property. For example:

RadContextMenu.SetFocusedElementType(this.listBox, typeof(ListBoxItem));

Another very useful feature is the ability of RadContextMenu to automatically bind to an IEnumerable of ICommand and to automatically execute the command that corresponds to the tapped context menu item. Here is how this feature can be used:

List<ICommand> musicCommands = new List<ICommand>()
{
    new PlayMusicCommand(),
    new MoreFromArtistCommand(),
    new BuyCommand(),
    new ShareCommand()
};
 
this.menu.ItemsSource = this.musicCommands;

Here is the result:

binding the context menu to a list of commands

You can see the full implementation of this example in our online documentation.

Finally, we decided to provide an ItemTapped event to RadContextMenu itself. You can still subscribe to the Tapped event of individual menu items, but if you want to handle all menu items with the same event handler you just subscribe once to the RadContextMenu.ItemTapped event and you're good to go.

We'd appreciate any feedback on the performance and usability of RadContextMenu so please post your thoughts on our forums

Enjoy the new release!


About the Author

Viktor Skarlatov

Software Developer,
Windows Phone Team

Comments

Comments are disabled in preview mode.