We want to custom filter the ListBox. The ListBox contains many virtualized data so the Filter event is out of discussion.
We also want to use the SearchTextBox but the value entered here could not represent the filter itself but must be combined with other data to form the filter. How could this be accomplished?
Actually an AndFilterExpression will do the job, but using the text from the SearchTextBox.
PS:Though I’m not sure the AndFilterExpression will do the job. The value from the SearchTextBox must be filtered against one property in the data object, or against another property in the same data object, depending of the value of a third property in the data object.
Imported from legacy forums. Posted by bogdip (had 390 views)
From what I understand, You want to be able to combine a UI Filter (the SearchTextBox) and a Code-Behind Filter.
Currently, in the ListBox template, we use a FilterControl that is bound to the SearchTextBox.
After some tests, here’s a workaround.
The idea would be to have the ListBox.FilterExpression be the combination of filterExpressions, so it is not modified. We can create a new ListBox with the new property OtherFilterExpression (the Code-behind filterExpression).
We can also create a new FilterControl, with a OtherFilterExpression property. This property would be bound to the new ListBox.OtherFilterExpression. This new FilterControl would combine its UIFilterExpression and OtherFilterExpression and store the result in its DataSourceFilterExpression (which is still bound to ListBox.FilterExpression).
To be able to use these new ListBox and FilterContol, we have to copy the current ListBox Template and replace the FilterControl with the newly created one.
You can find a sample in attachment. Simply reference Xceed.Wpf.Toolkit.dll and Xceed.Wpf.ListBox.dll to make it work.
Imported from legacy forums. Posted by Fawzi [Xceed] (had 505 views)