New to Telerik UI for WinFormsStart a free 30-day trial

Data Binding

Updated over 6 months ago

RadDataFilter will read the properties of its DataSource and will automatically create the corresponding descriptor items for each of them. It accepts DataTable, DataSet and BindingSource.

Design Time

You can set the DataSource property either via the Smart Tag or by the Properties section in Visual Studio.

Figure 1: DataSource property in Smart Tag

WinForms RadDataFilter DataSource property in Smart Tag

After specifying the DataSource property, the Descriptors collection will be automatically populated with descriptor items considering the available fields in the source object.

Figure 2: Automatically populated Descriptors collection

WinForms RadDataFilter Automatically populated Descriptors collection

Then, if you open the RadDataFilter Design Time Editor, you can select the desired items in order to build a filter expression.

Figure 3: RadDataFilter Design Time Editor

WinForms RadDataFilter RadDataFilter Design Time Editor

Run Time

It is possible to set the DataSource property programmatically as well.

Setting DataSource at run time

C#
DataTable dt = new DataTable();
dt.Columns.Add("Id", typeof(int));
dt.Columns.Add("Name", typeof(string));
dt.Columns.Add("IsActive", typeof(bool));
this.radDataFilter1.DataSource = dt;

After setting the DataSource property, the Descriptors collection is filled with the respective fields. Then, you can apply the desired filter either by setting the Expression property or by using the UI at run time.

Figure 4: RadDataFilter bound at run time

WinForms RadDataFilter RadDataFilter bound at run time

See Also

In this article
Design TimeRun TimeSee Also
Not finding the help you need?
Contact Support