• One common request that we are receiving recently is how to integrate the RadChart and RadContextMenu controls so they play nicely together.

    A typical real-life scenario would probably require that each ChartItem should display different (context-specific) set of menu items. In order to address the increased interest in this functionality we decided to add a new integration example for the Q1 2010 release but for those of you that need something working right now, here is a quick overview of the required steps to add context-specific menu to Bar series items in RadChart (this can be applied to any series...

  • Sometimes, when a button is clicked we want to display a drop-down menu with options. This is handy interface, usually present in toolbars, but sometimes - as standalone buttons, like the Save As button in the the VS2008 Save As dialog. Sometimes the drop-down buttons consist of two parts – action and menu, and are called split buttons. In this post I will demonstrate how to achieve the drop-down menu button part. If you need a split button, just add another button and keep track of what was the last clicked menu item. Note, that with Q3 2009 we will...

  • RadMenu for Silverlight supports simple checkable items, but still does not support radio button items. This feature is scheduled for development and most probably will come with Q3 2009, but until then you have to code it by yourself. Fortunately, this is relatively easy with a proper ViewModel, that contains the radio-button logic:

    checkablemenuitems

    The CommandItem class contains the properties and the logic for a RadMenuItem. It implements INotifyPropertyChanged and its most important property is IsChecked:

    public bool IsChecked
    {
        get
        {
            return this.isChecked;
        }
        set
       ...
  • RadMenu and RadContextMenu for Silverlight cannot automatically scroll their items if their height exceeds a certain height. We are planning to implement this feature in the near future, but at the moment there are two workarounds for the developers: override the RadMenu control template and add ScrollViewer controls around the ItemsPresenters, or customize the ItemsPanel of the RadMenuItem controls, so the sub-items are displayed in columns. The second option is much easier and looks good enough:

    MultiColumnMenu

    The main idea is to replace the RadMenuItem ItemsPanel, that is a StackPanel by default, with a WrapPanel. To set the ItemsPanel property of all...

  • This demo extends my previous sample, that demonstrated how to add a right click context menu on a TextBox. Here I will show how to create context sensitive main menu and toolbar, in addition to the context menu. The demo will also demonstrate some advanced enhancements that we added to the Silverlight 2 Framework, such as merged dictionaries and container bindings. The application enables/disables the Cut and Copy commands when there is no selection and also disables the Paste command when there is no clipboard content. As in the previous blog post, the clipboard methods work only in IE. Here is how...

  • This is part two of my Attaching a ContextMenu on TreeView blog post. I will show another approach for adding context menu on a treeview, that uses a single menu that is customized for each treeview item. One context menu per treeview should provide much better performance if the treeview is bound to a large data set, since there are much less visual elements that have to be created. I am also using an updated view model, where each item contains a reference to its parent. This will help me to rely entirely on the model for my application logic, which greatly...

  • How to add a right click context menu on a TextBox in Silverlight and also support simple editing commands, like Cut, Copy and Paste? This is pretty easy with RadContextMenu for Silverlight and I will show you now:

    contextmenuontextbox

    First I declared a TextBox and set the RadContextMenu.ContextMenu attached property on it:

    <TextBox x:Name="TextContainer" AcceptsReturn="True" TextWrapping="Wrap" Text="Right click to open a fully functional context menu that depends on the selection and the clipboard content">
       <telerikNavigation:RadContextMenu.ContextMenu>
           <telerikNavigation:RadContextMenu ItemClick="ContextMenuClick" Opened="ContextMenuOpened" Closed="ContextMenuClosed">
                <
    telerikNavigation:RadMenuItem Header="Cut" />
                <
    telerikNavigation:RadMenuItem Header="Copy" />
                <
    telerikNavigation:RadMenuItem Header="Paste" />
            </
    telerikNavigation:RadContextMenu>
        </
    telerikNavigation:RadContextMenu.ContextMenu>
    </TextBox>

     

    If you want to open the context menu with Right click, you need to make the Silverlight plug-in windowless. Otherwise, you should set the EventName and/or ModifierKey properties on RadContextMenu to configure it...

  • Telerik RadControls for Silverlight provide a very powerful ContextMenu control, that supports right click, modifier keys and that can be easily attached to any visual element. In this article I will show how to attach RadContextMenu to a data-bound RadTreeView and perform actions on the clicked treeview items, depending on the selection in the context menu. For simplicity, here I will use a treeview, bound to a static collection, but it can be easily extended to load its items from a web service:

    <UserControl x:Class="ContextMenuInTreeView.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:ContextMenuInTreeView" xmlns:telerik="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls" xmlns:telerikNavigation="clr-namespace:Telerik.Windows.Controls;assembly=Telerik.Windows.Controls.Navigation"> <UserControl.Resources> <local:DataViewModel x:Key="ViewModel" /> <telerik:HierarchicalDataTemplate x:Key="TreeViewItemTemplate" ItemsSource="{Binding Children}"> <TextBlock Text="{Binding Text}"> <telerikNavigation:RadContextMenu.ContextMenu> <telerikNavigation:RadContextMenu> <telerikNavigation:RadMenuItem Header="New Child" /> <telerikNavigation:RadMenuItem Header="New Sibling" /> <telerikNavigation:RadMenuItem Header="Delete" /> </telerikNavigation:RadContextMenu> </telerikNavigation:RadContextMenu.ContextMenu> </TextBlock> </telerik:HierarchicalDataTemplate> </UserControl.Resources> <StackPanel Background="White" DataContext="{StaticResource...