Telerik blogs

Q2 2011 is approaching and along with the other new controls and features that we are going to provide, we are going to equip RadGridView with an Expression Editor. This powerful editor will allow you to build complex expressions using a simple Domain Specific Language, reminiscent of formulas in many popular spreadsheet applications. It will be supported at both design time and run time. 

Rad Expression Editor for Windows Forms

No matter whether you want to build expressions from scratch or select one of the prebuilt functions, RadExpressionEditor will provide a convenient means to do that. It will contain a selectable list of functions, operators, constants and fields. It will show a detailed description of the selected function and most importantly an instant result preview of the created expression as you type it. It will not allow the end user to confirm an invalid expression, which cannot be parsed.

There are also other benefits for the end user. RadGridView columns will expose a property called EnableExpressionBuilder and if you set it to true, a new menu item will be added to the standard context menu of the unbound columns. This item will allow the end user to open the expression editor and easily make a complex expression at run time. In addition, you will be able to open RadExpressionEditor for a particular column on a custom user action, for example, on a button click, without using the standard UI of RadGridView.

Invoking Rad Expression Editor for RadGridView for Windows Forms

 

Under the hood, in order to give you more power, we have added support for dozens of new expression functions. They will offer text, date-time, mathematical, logical and conversion operations. But this is not all. A unique opportunity will be provided through a simple mechanism for adding and using custom functions. If you cannot find the required one in our lengthy list – no problem, you can add and use one of your own:

public Form1()
{
    InitializeComponent();
    ExpressionContext.Context = new CustomExpressionContext();
}
  
private void Form1_Load(object sender, EventArgs e)
{
    this.radGridView1.Columns["expression"].Expression = "POWER(Pi() * [radius_column],2)";
}
  
public class CustomExpressionContext : ExpressionContext
{
    /// <summary>
    /// My custom function, which returns Pi.
    /// </summary>
    /// <returns></returns>
    public double Pi()
    {
        return Math.PI;
    }
}

 

If you think this is enough for a tool like an expression editor, we don’t! On top of all the features described above, RadExpressionEditor will fully support the unique Telerik styling mechanism. You will be able to use any of predefined themes or create a custom one.

In addition, a full localization support will be provided, not only for the elements contained in the expression form, but for the descriptions of all functions.
Last, but not least, through a smart xml loading mechanism, you, as developer, will be able to completely customize the functions available in the editor, change their description, remove existing or add new custom ones. 
 

Register Today

 

Register for the Free Webinar on What's New in RadControls for WinForms in Q2 2011.

Register now as seats are limited!

When: Wednesday, July 20

2:00 PM - 3:00 PM EDT Register 

Check this page for the full Q2 2011 webinar listing.


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.