views:

185

answers:

0

Hi,

I was wondering if it's possible to use the FilterDescriptor control from code behind?

On the page load of my form I set the datasource of a grid in the code behind, not using a DomainDataSource control, like:

TestDomainContext context = new TestDomainContext();
dataGridEmployees.ItemsSource = context.EmployeePositions;
context.Load(context.GetEmployeesWithPositionQuery());

I have a textbox on my page that the user can enter into to filter on employee position.

Is it now possible to add FilterDescriptor to the source of the DataGrid in code behind? Or would I manually need to filter the results of the context.GetEmployeesWithPositionQuery, for example on KeyUp event of the filter TextBox?