Home Products Downloads Purchase Support Forum About Blog

VIBlend Silverlight Controls – Announcing new version 1.3

by viblend 27. December 2009 19:37

We are proud to announce the release of the latest version of VIBlend Silverlight Controls.

The new edition includes many improvements in VIBlend’s OLAP Grid for Silverlight:

  • Significantly better performance
  • Lower memory use
  • Data binding improvements and LINQ support
  • Layout enhancements with variable height columns
  • Pivot table sorting by label
  • Better design time support in Visual Studio 2010 Beta

The release of version 1.3 brings a new Silverlight TreeView control loaded with advanced features, stylish animations and offering easy to use and flexible programming model.

See our Silverlight Controls Live Demo and Download a free trial today.

Custom node Editors with VIBlend TreeView for Silverlight

by viblend 23. December 2009 19:12

Today, we are going to share with you how you can use custom editors in our brand new TreeView control. The process of assigning a custom editor includes three steps. The first step is to make the TreeView editable. To do that, set its EnableItemEdit property to true which will ensure that an edit operation will start over the Selected item when you press the F2 key.

   Style="{StaticResource OfficeBlackTreeViewStyle}"

      DisplayValue="Product - Espresso Truffle" 
      Style="{StaticResource OfficeBlackTreeViewItemStyle}" 
      EditTemplate="{StaticResource ComboBoxTemplate}"
      Value="Espresso Truffle">

The second step is to set the DisplayValue, Value and EditTemplate properties of the TreeViewItem in order to associate the custom editor with the specific TreeViewItem. The TreeView uses a TextBox control as a default editor.

The DisplayValue property represents the value which will be displayed when the item is shown. The Value property represents the logical value which will be edited.  The most important property which we need to set is the EditTemplate. It specifies the actual DataTemplate of the custom editor control. Here is the ComboBoxTemplate which we use as an EditTemplate in our TreeViewItem.

 <DataTemplate x:Name="ComboBoxTemplate">
      <ComboBox SelectedIndex="0">
           <ComboBoxItem Content="Green Tea"/>
           <ComboBoxItem Content="Caffe Espresso"/>
           <ComboBoxItem Content="Caffe Latte"/>
           <ComboBoxItem Content="White Chocolate Mocha"/>
           <ComboBoxItem Content="Caffe Americano"/>
           <ComboBoxItem Content="Cappuccino"/>
           <ComboBoxItem Content="Espresso Truffle"/>            

Finally, you need to update the editor’s value when the edit operation begins and we need to save the edited value when the edit operation ends. We will do this step in the code behind.

Subscribe to the ItemBeginEdit and ItemEndEdit events.

 this.TreeView.ItemBeginEdit += new VIBlend.Silverlight.Controls.TreeView.ItemStateChangedHandler(TreeView_ItemBeginEdit);

 this.TreeView.ItemEndEdit += new VIBlend.Silverlight.Controls.TreeView.ItemStateChangedHandler(TreeView_ItemEndEdit);

Set the editor’s value when it is opened. This will allow us to show the item in the combobox which corresponds to the edited TreeViewItem’s value.

void TreeView_ItemBeginEdit(object sender, TreeViewEventArgs args)
     if (args.Item.EditTemplate == this.ComboBoxTemplate)
          ComboBox comboBox = this.ComboBoxTemplate.LoadContent() as ComboBox;
          int index = 0;
          foreach (ComboBoxItem item in comboBox.Items)
                    if (item.Content.Equals(args.Item.Value))
                        ComboBox editor = this.TreeView.ActiveEditor as ComboBox;
                        editor.SelectedIndex = index;



Save the editor’s value when the edit operation has finished. In the sample code we update the Value and DisplayValue properties.

void TreeView_ItemEndEdit(object sender, TreeViewEventArgs args)
            if (args.Item == null)

            if (args.Item.EditTemplate == this.ComboBoxTemplate)
                ComboBox editor = this.TreeView.ActiveEditor as ComboBox;
                ComboBoxItem item = editor.Items[editor.SelectedIndex] as ComboBoxItem;
                args.Item.Value = item.Content;
                args.Item.DisplayValue = "Product - " + args.Item.Value;

The full demo source code is included in the installation of VIBlend Silverlight controls. You can also see the online demo in action as part of  the Live demo of VIBlend Silverlight Controls.

About the author

Some text that describes me

Tag cloud

Recent comments

Comment RSS
Copyright © 2011 VIBlend  
Terms of Use | Privacy Policy
WinForms Controls Purchase Online About Us
DataGrid Navigation Pane Technical Support Blog
ScrollBar TreeView
ListBox ProgressBar Downloads Register
ComboBox Buttons
TabControl Editors Documentation Client Login

VIBlend Blog is powered by BlogEngine.NET