• .NET

    Self-reference hierarchy with Telerik TreeView for Silverlight

    August 26, 2009 Share
    Often we need to display in a TreeView flat, self-referencing data, loaded from a database, that has properties ID and ParentID (or similar) that define the hierarchy. The Telerik TreeView for ASP.NET can automatically bind itself to such data, but our Silverlight TreeView cannot do this out of the box. Fortunately, this “limitation” can be easily avoided with a simple value converter. There is a little trick, however – each data item needs a reference to its parent collection. Consider the following very simple data object: public class DataItem : INotifyPropertyChanged { private string text;   public int ID { get; set; } public int ParentID {...
  • .NET

    RadioButton and CheckBox Menu Items with RadMenu for Silverlight

    June 19, 2009 Share
    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: 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 ...
  • .NET

    Scrollable Menu – Workaround with a Multi-Column Menu and RadControls for Silverlight

    June 18, 2009 Share
    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: 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...
  • .NET

    Binding a ComboBox to Enum Values with RadControls for Silverlight

    June 12, 2009 Share
    A common request in our support is to display a combo box, containing all values of a specific Enum. This is fairly easy with RadComboBox for Silverlight - all you need to do is to fill its ItemsSource collection with the Enum values. The best way to do this is to create a view model for the Enum: using System; using System.Collections; using System.Linq; using System.Reflection; namespace SilverlightApplication1 { public class EnumModel { private Type enumType; public IEnumerable Values { get; private set; } [TypeConverter(typeof(TypeTypeConverter))] ...
  • .NET Mobile

    Common RadWindow issues and their solution

    The RadWindow control is part of the Telerik’s RadControls for ASP.NET AJAX suite and is intended to replace the standard browser’s popup (window.open()). Since the control is based on an IFRAME, it behaves just like one – basically, whatever can be done with an IFRAME, can be achieved with RadWindow as well. This fact is useful when you investigate a reason for some problem related to the RadWindow control. Just replace the RadWindow with a standard IFRAME or browser’s popup and see how your application will behave in this case. If the problem still exists, then it is not related to the...