Telerik blogs

We were eagerly awaiting the Q1 release to demonstrate you the new cleaner and more flexible API that makes the work with RadTreeView fun. We also wanted to tell you something more about the benefits that come with the new data engine.

Now that Q1 2011 is public and the improved RadTreeView is a fact, I would like to introduce the enhancements which we implemented during the last few months.

Screenshot1

 

The new data engine that we use in RadTreeView is actually our generic data layer used in RadGridView and other controls such as RadListControl and RadDropDownList. This allowed us to add new features such as filtering and sorting and to improve performance. We also extended the API and now we support new binding modes such as object-relational binding. Using this mode one can bind to a set of objects containing collections of related objects. Despite all these features, now RadTreeView uses half the memory used by the old version.

We did not stop here. Now the user interface is fully customizable and you can even replace the UI elements and create your own.

The new NodeFormatting event is convenient in such scenarios. The next example demonstrates how to change the node color and font on a certain condition.

void TreeViewElement_NodeFormatting(object sender, TreeNodeFormattingEventArgs args)
{
    TreeNodeContentElement element = args.NodeElement.ContentElement;
    DataRowView rowView = (DataRowView)args.Node.DataBoundItem;
    if ((bool)rowView["IsNew"])
    {
        element.Font = boldFont;
    }
    else
    {
        element.ResetValue(LightVisualElement.FontProperty, ValueResetFlags.Local);
    }
    element.Text = "<html> " + args.Node.Text + "<color=blue>(" + args.Node.Nodes.Count + ")";
}

 

Here is the result:

 

Another interesting feature is the alternating row coloring.

 

Just set the AllowAlternatingRowColor and AlternatingRowColor properties to get the result:

this.radTreeView1.TreeViewElement.AllowAlternatingRowColor = true;
this.radTreeView1.TreeViewElement.AlternatingRowColor = Color.FromArgb(210, 210, 210);

 

It is easy to create a property editor using the editing capabilities of RadTreeView. It supports textbox editor, dropdown list editor, spin editor and date time editor and it is easy to add a custom editor or to control and change the editor’s behavior. There is a nice demo regarding this feature in our demo application.

We extended the checkbox support in RadTreeView and now you can mix checkboxes and radio buttons and their behavior is controlled by the control automatically.

 

Finally, we implemented in RadTreeView our generic drag & drop service. Now it is easy to drag & drop items between trees or other controls.

 

We believe that you will like these new features. As always we appreciate your feedback and we will be glad to know if you have some new ideas to share.


About the Author

Nikolay Diyanov

Diyanov is the Product Manager of the Native Mobile UI division at Progress. Delivering outstanding solutions that make developers' lives easier is his passion and the biggest reward in his work. In his spare time, Nikolay enjoys travelling around the world, hiking, sun-bathing and kite-surfing.

Find him on Twitter @n_diyanov or on LinkedIn.

Related Posts

Comments

Comments are disabled in preview mode.