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

Is it possible to change the default behavior of Filter option

5 Answers 51 Views
TreeListView
This is a migrated thread and some comments may be shown as answers.
gans
Top achievements
Rank 1
gans asked on 20 May 2012, 11:02 PM
We have a requirement where we need the Filter Option Dialog/ filter functionality to behave differently from the default behavior. 

We don't want  to really FILTER the data, but to select/unselect the nodes that match the criteria. 

Would it be possible to do this?

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 21 May 2012, 06:25 AM
Hi,

 You can create custom filtering control similar to this demo where you can embed your own logic. The same example can be found in your local copy of our WPF examples. 

Kind regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
gans
Top achievements
Rank 1
answered on 21 May 2012, 12:05 PM
Vlad,

Thanks for the quick response. I was wondering whether it would be possible to use your default Filter Control that you guys provide and just change the Filtering logic? 

Is that possible or I need to create new Custom Control and do my logic in there?

0
Vlad
Telerik team
answered on 21 May 2012, 12:26 PM
Hello,

 If you want to change just the distinct values you do not need to change anything - just provide your own list of values in the event. 

Indeed you can use the default filtering template extracted with blend with changed logic however in this case it will be better to use your own template/control to embed custom logic. 

Regards,
Vlad
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

0
gans
Top achievements
Rank 1
answered on 23 May 2012, 10:56 PM
I am trying to come up with Custom Filter Control as you suggested. But its going to look almost exactly like the default control you have provided. 

I was looking at the example you had pointed out for Custom Filter. But this example doesn't show any Distinct Values like the default Filter Control. It just has two Date Controls and these dates are applied to the Filter.

I have ListBox in my Control like yours and how do I populate the ListBox with distinct values?  I got the Listbox from your template as below. 

 I am struggling to come up with something close to what you guys have. 

Do you have an example where it will list the Distinct Values of each column in the Custom Filter?

Is the Prepare() method supposed to load the Distinct Values to the ListBox?

0
Rossen Hristov
Telerik team
answered on 24 May 2012, 09:02 AM
Hello,

RadGridView has a public method called GetDistinctValues (with several overloads). You can use this public method to get a list of the distinct values which you can then display in any kind of ItemsControl.

Or if you prefer, you can extract the distinct values from your data source in any other way that you find applicable, for exampel using LINQ

If you have our source code, your best shot will to explore the XAML and code-behind of our stock FilteringControl in order to understand what it does and how.

The XAML is located in FilteringControl_Style.xaml and the code behind is located in FilteringControl.cs. The view model serving the FilteringControl is inside FilteringViewModel.cs. Examine the source code if you want to learn what we are doing internally. The source code is far from trivial I am afraid.

Greetings,
Ross
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
TreeListView
Asked by
gans
Top achievements
Rank 1
Answers by
Vlad
Telerik team
gans
Top achievements
Rank 1
Rossen Hristov
Telerik team
Share this question
or