Hi,
I'm showing records in group (not XamDataGrid Grouping, records are just place one after the other with special presenter) and I wish to keep the hole group if one of the record pass the filter test.
For example, Record 0 {Group="A", Name = "Post", Amount = 1.00} Record 1 {Group="B", Name = "Foo", Amount = 12.00} Record 2 {Group="B", Name = "Bar", Amount = 1.30} Record 3 {Group="C", Name = "Alice", Amount = 1.70} Record 4 {Group="C", Name = "Bob", Amount = 100.22}
If the user filter the field "Name" with Equal "Bar" than only record 1 and 2 will show up because record 2 pass the test and record 1 is of the same group of record 2.
If the user filter the field "Amount" with greater than 100 than only record 3 and 4 will show up, for similar reasons.
Any ideas, how to do that?
Thanks,
Dominik
Hi Shash,
This post is over 6 years old, Infragistics WPF has evolved since then, maybe they have a better solutions now.
But the solution described above is to handle this event RecordFilterDropDownPopulating from the DataPresenter (XamDataGrid in my case)
https://ko.infragistics.com/help/wpf/infragisticswpf.datapresenter~infragistics.windows.datapresenter.datapresenterbase~recordfilterdropdownpopulating_ev
which giving you a chance to populate the filter drop-down with your own items.
See the example provided in the link above.
Good luck,
HI Dominik,
I am facing similar challenge(Need to filter record from Grid). Could you please suggest how to proceed here?
Helle Elena,
I didn't notice that event, before. We learn each day... Anyway, this solution works perfectly,
In RecordFilterDropDownPopulating event handler I loop through each visible record,
Filter empty values Sort Distinct And use that to fill the FilterDropDownItem.
The final behavor seem perfect.
Thanks for your help,
Hello Dominik,
Thank you for the sample application. I was researching for a solution about the issue you are describing about the dropdown value, and I believe that currently there is no built in functionality to show the Filtered out values. Still please have in mind that you can populate the filter drop down in order to suit your requirements manually. In order to achieve this I can suggest you handle the RecordFilterDropDownPopulating event of XamDataGrid and add the missing values as new FilterDropDownItem. For further reference about this functionality, please have a look at our sample browser in the section XamDataGrid->Record Filtering->Custom Filter Drop-down Items. There in the handler of the RecordFilterDropDownPopulating event is shown how you can invoke a method AddFilterDropDownItems following the template:
private void AddFilterDropDownItems(IList<FilterDropDownItem> filterList) { FilterDropDownItem item; item = new FilterDropDownItem(new Infragistics.Windows.Controls.ComparisonCondition(Infragistics.Windows.Controls.ComparisonOperator.Match, "^[A-F]"), "[A-F]"); filterList.Add(item); item = new FilterDropDownItem(new Infragistics.Windows.Controls.ComparisonCondition(Infragistics.Windows.Controls.ComparisonOperator.Match, "^[G-K]"), "[G-K]"); filterList.Add(item); item = new FilterDropDownItem(new Infragistics.Windows.Controls.ComparisonCondition(Infragistics.Windows.Controls.ComparisonOperator.Match, "^[L-P]"), "[L-P]"); filterList.Add(item); item = new FilterDropDownItem(new Infragistics.Windows.Controls.ComparisonCondition(Infragistics.Windows.Controls.ComparisonOperator.Match, "^[Q-Z]"), "[Q-Z]"); filterList.Add(item); }
If you have any additional questions on this matter, please do not hesitate to ask.
Hi Elena,
Thanks for your reply,
Question 1. I copied the DataRecordPresenter from the DefaultStyles folder and commented out the IsFiteredOut trigger, and that question is resolved perfectly. Don't know why there was a hard line below, anyway the visual is as expected now.
Question 2. Any news on this one. In the example I attach, you can view the problem by adding a filter to one of the field and see that the field filter drop down content of any other field doesn't contain all the visible field cell values. (you might have to read the previous sentence a few times!)
Question 3. Ok RecordFilterChanged will be.
Other question. I'm a little bit confuse about that misterious question, I did reference "DataRecordPresenter.FromRecord" in my first question, but it was just a notice. And the unwanted behavior (the gray foreground of the filtered out records) was resolved by you're DataRecordPresenter style solution. Anyway, I sent you an example project.