$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
GridView Windows Forms Control
ExpressionEditor of GridView create expressions for grid in C# WinForms applications
Home > WinForms UI Controls > User Manual > Customize Data Grid with Expression Editor in C#

Create Custom ExpressionEditor to GridView in C#.NET

The ExpressionEditor of GridView is a powerful editor used for create complex expressions. It is easy to access the predefined functions, operators, and constants as well as GridView fields. The Expression Builder of the editor allows the users easily look up and add components and fast enter accurate expressions as well. It is able to start the Expression editor from the context menu in a specific grid column, initialize it by using C# code and use it at design time. Moreover, the end users can simply use the ExpressionEditor

How to Create Custom Expression Functions in C#

The Kettic GridView has already contains amount of functions that have been predefined. However, when the users need additional functions, the GridView can meet their requirements too. The users are allowed to create a custom expression method and use the method in ExprssionEditor or as a value of the Expression property. This is achieved by creating a new ExpressionContext C# class to derive from the one in GridView component. The following is the C# code showing how to accomplish that.

public class CustomExpressionContext : Kettic.Data.Expressions.ExpressionContext
{
public double Pi()
{
return Math.PI;
}
}
When we implement the above method, we can set the new custom ExpressionContext C# class for the static Context property and then use the new expression method as below.

Kettic.Data.Expressions.ExpressionContext.Context = new CustomExpressionContext();

this.ketticGridView1.Columns["expression"].Expression = "PI()";

How to Create Custom Functions List in C#

To customize the UI elements available, localize functions descriptions and create custom functions, the Kettic ExpressionEditor provides the support of loading functions, operators and constants from an xml file. The source XML file describes the complete values available based on such an xml structure. The LoadXML method could help the users to load the xml file to their project with the C# code below.

string path = "Kettic.Examples.WinForms.GridView.Expressions.ExpressionItemsListData.xml";
Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(path);
KetticExpressionEditorForm.ExpressionItemsList.LoadFromXML(stream);
UI Controlsfor Windows Forms
.NET WinForms UI Overview.NET WinForms UI Features.NET WinForms UI GuideC# WinForms UI DesignVB.NET WinForms UI Design
WinForms UI Controls