Current filter:
                                You should refresh the page.
                                  • Hi DevExpress,

                                    In my App I have a GridControl with View=TreeListView . I set the FilterMode to ParentBranch. So if I filter the rows, the parent will be visible, too.

                                    [XAML]
                                    <dxg:GridControl Name="ifcGrid" Grid.Row="1" AutoGenerateColumns="None" EnableSmartColumnsGeneration="True" ItemsSource="{Binding Path=IfcElements}"> <dxg:GridControl.View> <dxg:TreeListView ShowTotalSummary="True" TreeDerivationMode="Selfreference" ParentFieldName="ParentIfcId" KeyFieldName="IfcId" CustomUnboundColumnData="TreeListView_CustomUnboundColumnData" FilteringMode="ParentBranch" Name="treeView"/> </dxg:GridControl.View> </dxg:GridControl>

                                    Now I want to iterate through the nodes and determine the rows, which are displayed, because of the filter and not because they have matching children.

                                    [C#]
                                    for (int i = 0; i < this.xGrid.VisibleRowCount; i++) { var node = this.treeView.GetNodeByVisibleIndex(i); //node.IsFiltered <-- here only the nodes, which match the filter }

                                    Thank you for your help.

                                    Cheers
                                    Laszlo

                                1 Solution

                                Creation Date Importance Sort by

                                Hi Laszlo,

                                To achieve this, I suggest you use the ExpressionEvaluator Static Undocumented Helper as follows:

                                [C#]
                                bool IsExpressionFit(Employee content, string expression) { object row = content; try { System.ComponentModel.PropertyDescriptorCollection properties = System.ComponentModel.TypeDescriptor.GetProperties(row); var eval = new DevExpress.Data.Filtering.Helpers.ExpressionEvaluator(properties, DevExpress.Data.Filtering.CriteriaOperator.Parse(expression)); return eval.Fit(row); } catch (Exception) { return false; } }

                                I am attaching a project demonstrating this.

                                Best regards,
                                Boris

                                • Laszlo Vörös 11.08.2019

                                  Hi Boris,

                                  thank you for your answer, but unfortunately it cannot solve my problem . I know I could evalute the filter on my object.
                                  But my treelistcontrol has calculated fields, too. The user can also add some calculated (unbound) columns. Then the user can apply a filter based on this calculated column. You can see, the values in the filter are not necessarily part of my object. So I need a solution to evaluate the node with its unbound columns.

                                  It would be soo nice, to solve this problem.

                                  Thanx
                                  Laszlo

                                • Boris (DevExpress Support) 11.08.2019

                                  Hi Laszlo,

                                  Thank you for your clarification.
                                  To achieve this goal, you will need to use descendants of TreeListView and TreeListDataProvider as I showed in the project attached to this comment.

                                  Best regards,
                                  Boris

                                • Laszlo Vörös 11.08.2019

                                  Thank you, it is working fine!

                                • Boris (DevExpress Support) 11.08.2019

                                  You are welcome!