14 Answers, 1 is accepted
What are the types that you are trying to filter on? Are they complex types?
I have attached a simple sample project. Could you please either modify it so it reproduces the behavior you are faced with or create a one of your own and send it to us. We will take a look to see what is going on.
Thanks in advance.
Ross
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

first, the columns consist of and array of multiple values and the converter
format all the values one one line as the following: Value1, Value2, Values3, etc...
Thank's
There is no way to filter a column which is of this type. The easiest way to do this, would be to create a new read-only string property on your business object / ViewModel and make this string property return the concatenated values. Then bind the column to this string property and you will get normal string filtering. There is no other way to achieve what you are trying to do.
I hope this helps.
Ross
the Telerik team
Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

I remembered spotting a couple of things on the forum (custom filtering and expression grouping) which made me think it must be possible to achieve filtering on a column that's bound to a list using similar tactics. So after a bit of hacking about I've adapted the original solution posted by Ross and have the foundations of a solution. For the interested here's what I did:
I updated the the Player object so that a player can now play a number of positions, this is bound to the column and a converted used show a comma delimited list in the grid cell.
I then created a custom filter control (implementing the IFilteringControl interface) which will allow us to perform some fairly basic filtering and set this to the column's filtering control.
<
telerik:GridViewDataColumn
UniqueName
=
"myCol"
DataMemberBinding
=
"{Binding Positions, Converter={StaticResource PositionConverter}}"
>
<
telerik:GridViewDataColumn.FilteringControl
>
<
my:EnumListFilteringControl
/>
</
telerik:GridViewDataColumn.FilteringControl
>
</
telerik:GridViewDataColumn
>
I then needed to make the column think it was filterable so it will show our custom filter control, unfortunately the above alone wasn't enough. To do this we need to override the DataType property of the column on the Loaded event of the grid:
var myCol = grid.Columns[
"myCol"
]
as
GridViewDataColumn;
if
(myCol !=
null
)
{
// make sure we can filter on our column
myCol.IsFilterable =
true
;
// make sure we can group or sort, this will cause us problems just now..
myCol.IsGroupable =
false
;
myCol.IsSortable =
false
;
// need to make the column think its a string of we'll not get the filter button..
myCol.DataType =
typeof
(
string
);
}
Now for the magic, inspired by the expression group descriptor example I found on the forum I created an ExpressionFilterDescriptor which allows us to build an expression to filter the Player's positions:
public
class
ExpressionFilterDescriptor<TElement> : FilterDescriptor
{
public
Expression<Func<TElement,
bool
>> FilterExpression {
get
;
set
; }
public
override
Expression CreateFilterExpression(Expression instance)
{
return
ParameterRewriter.Rewrite(
this
.FilterExpression, (ParameterExpression)instance);
}
}
This is then used in the View Model of the custom filter control to build a simple expression which is then used by the grid to filter the data.
The updated solution can be found below, its not very tidy and will need to be made more generic before I can use it in my project but hopefully it will help a few folk out and give you a head start in your own solution, there is also a feature where the filter control doesn't load the list first time but toggling the filter will get round this.
http://nyami.rakhama.com/RadGridView-WPF-FilterOnList.zip
Cheers
Doug
This is simply brilliant. I have updated your account with Telerik points.
With your permission, can we create a code library with your project?
Ross
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Of course, please use anything from the project that will help, I'm sure you'll be able to work out whats going on.
I had meant to add to my previous post that the expression filter can also be used for pretty much any expression on a list item, for example if you had a method that worked out if a player has talent you could use the filter below.
var filter =
new
ExpressionFilterDescriptor<Player>{
FilterExpression = p => PlayerHasTalent(p)
};
grid.FilterDescriptors.Add(filter);
Cheers
Doug
I have totally forgotten about the FilterDescriptor<T> that we provide out-of-the-box.
The FilterDescriptor<T> allows you to directly plug a predicate that determines which items are filtered. You just need to set a lambda to the FilteringExpression property like so:
var descriptor =
new
FilterDescriptor<Employee> { FilteringExpression = e => prospects.Contains(e) };
I suppose that we have created the same thing. Thinking alike is definitely a good thing.
Anyway, I will definitely ask the marketing guys for the stress ball :)
I will let you know when they answer.
Cheers!
Best wishes,
Ross
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Having checked the help again I've spotted the generic SortDescriptor and GroupDescriptor which will help with the next challenge.
Doug
Can you please give me a shipping address and a desired t-shirt size?
Greetings,Ross
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Cheers again!

This solution is exactly what I'm looking for, but the zip file on your site appears invalid. Do you have a valid zip for this, or has the telerik team cleaned it up and have their own solution available?
Thanks

The issue I have now is the filter indicator shows the column as being filtered, except when you scroll the column out of sight and then back in sight, the filter indicator no longer shows the column as being filtered.

Have you, or the Telerik team, assembled a sample of this solution? Doug's example appears to be unreachable.
Best,
Moe
Since this conversation is two years old, can you please define your exact problem/task in greater detail?
You can even open a new forum thread or support ticket, which will be much better since we try to isolate issues from one another and not mix them together.
Thank you.
Rossen Hristov
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>