BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi
Kevin,
We have
analyzed your query and you can achieve your requirement to reuse same
filtering condition by using FilterChanging and FilterItemsPopulated events.
Please find the code snippet in below,
In
FilterChanging event, we have created filter predicate using Equals filter type
without considering checked and unchecked items. So you can reuse the filter
predicate for different itemssource.
Code
Snippet [C#]:
this.dataGrid.FilterChanging += dataGrid_FilterChanging; this.dataGrid.FilterItemsPopulated += dataGrid_FilterItemsPopulated; private void dataGrid_FilterChanging(object sender, Syncfusion.UI.Xaml.Grid.GridFilterEventArgs e) { if (e.FilterPredicates == null || filterItems == null ||
!e.FilterPredicates.Any() || !filterItems.Any())
return;
e.FilterPredicates.Clear(); var selectedItems =
filterItems.Where(x => x.IsSelected); int I = 0; foreach (var item in selectedItems) {
if (I == 0)
e.FilterPredicates.Add(new FilterPredicate()
{
FilterValue = item.ActualValue,
FilterType = FilterType.Equals,
FilterBehavior = FilterBehavior.StronglyTyped,
IsCaseSensitive = true,
PredicateType = PredicateType.And
});
else
{
e.FilterPredicates.Add(new FilterPredicate()
{
FilterValue = item.ActualValue,
FilterType = FilterType.Equals,
FilterBehavior = FilterBehavior.StronglyTyped,
IsCaseSensitive = true,
PredicateType = PredicateType.Or
});
}
i++; } } private void dataGrid_FilterItemsPopulated(object sender,
Syncfusion.UI.Xaml.Grid.GridFilterItemsPopulatedEventArgs e) {
filterItems = e.ItemsSource as Ienumerable<FilterElement>;
e.FilterControl.FilterMode = FilterMode.CheckboxFilter; } |
Please
let us know if this solution helps you.
Regards,
Saravanan
C