Telerik blogs
  • Web

    Data-binding menu, context menu and toolbar, a.k.a. a simple text editor for Silverlight

    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...
  • Web

    Reusing and customizing a single ContextMenu on a TreeView with RadControls for Silverlight

    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...
    June 01, 2009
  • Desktop WPF

    Enhancing the Localization Support of RadControls for Silverlight and WPF

    With the Q1 2009 SP2 release of RadControls for Silverlight we introduced an enhancement of the LocalizationManager class. Two new properties were added to enrich the localization support in the suite - DefaultCulture and DefaultResourceManager. With the new properties you no longer have to always create an instance of the LocalizationManager. Here is a brief description of the two properties: DefaultCulture A static property of type System.Globalization.CultureInfo. Use this one to change localized values without changing the UI culture of the current thread. DefaultResourceManager A static property of type System.Resources.ResourceManager. Use this one to change localized values using a new resource manager, i.e. a new resource file. Example: The attached...
  • Desktop WPF

    How to apply different templates to different appointments of Telerik Scheduler for WPF/Silverlight.

    In the upcoming Q2 release RadScheduler  will include a new property called AppointmentTemplateSelector. This property will be included in both  Silverlight and WPF versions of the control. Using it,  you will be able to easily apply different DataTemplate  to the appointments by any custom condition. All you need to do is to create a custom class inheriting from the  DataTemplateSelector class and override the SelectTemplate method.   For...
  • Web

    How to add a right click context menu on a TextBox in Silverlight?

    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: 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> .csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, "Courier New", courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; }   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...