This is a migrated thread and some comments may be shown as answers.

Tree not expanded in new filter after collapsing it during previous filter

2 Answers 88 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Johan
Top achievements
Rank 1
Johan asked on 25 Apr 2017, 06:39 AM

We use the following code to put a filter on tree items which work great intially.

snip .....

TreeListView.FilterDescriptors.SuspendNotifications();
ClearFilters();

ApplyFilter(Reflector.GetProperty<ProjectReleaseLineViewModel>((line) => line.HasError).Name, true, FilterOperator.IsEqualTo);

snip ......

 

private void ClearFilters()
{
           foreach (var column in TreeListView.Columns.OfType<Telerik.Windows.Controls.GridViewBoundColumnBase>())
           {
                var filterControl = column.FilteringControl as ColumnFilterControl;
if (filterControl != null)
{
filterControl.Reset(column);
}
}
}

private void ApplyFilter(string member, object value, FilterOperator @operator = FilterOperator.IsEqualTo)
{
var filter = new CompositeFilterDescriptor();
filter.FilterDescriptors.Add(new FilterDescriptor(member, @operator, value));
var colum = TreeListView.Columns.OfType<GridViewBoundColumnBase>().Skip(2).First();
colum.DataControl.FilterDescriptors.Add(filter);
}

When performing this action the tree explands showing the lines which have errors.

The strange behaviour happens after that through the following actions.

- The use manually collapses the expanded items al the way to level zero

- Then the filter is cleared through the following code

 

 

2 Answers, 1 is accepted

Sort by
0
Johan
Top achievements
Rank 1
answered on 25 Apr 2017, 06:40 AM
Sorry the initial item is not complete yet but posted already unintentionally....
0
Johan
Top achievements
Rank 1
answered on 25 Apr 2017, 06:48 AM

So I will continue my post.

- The filter is cleared by calling Clearfilters()

- Then the same filter is applied with exactly the same code.

- Now the tree is not expanded and the lines wiith errors do not show up.

- The work around is: manuallly expand the earlier collapsed items again, then clearing the filter. If then a items are collapsed the filter work appropriately again.

So the questions is why is the treeview behavinf like this and why does it not always expand.

The Telerik WPF windows library used is: 2012.2.912.35

Although being in different parts in a post I hope this is clear.

Thanks,

Johan

 

 

 

Tags
TreeView
Asked by
Johan
Top achievements
Rank 1
Answers by
Johan
Top achievements
Rank 1
Share this question
or