I would like to achieve the following with the filtering option in the gridview:
1. Make the filter icon only visible on mouseover of the header.
I partly achieved this by changing the GridViewHeaderCellStyle. However there are a few issues. When a column is sorted, the filter icon isn't visible onmouseover. So this isn't an acceptable solution. I also tried to use different visualstategroups, but couldn't get this to work properly either.
2. I would like to have the filter icon visible when a filter is applied. I investigated the options of achieving this through the GridViewHeaderStyle as well as through the DistinctFilterControlTemplate but I was unable to find a solution.
I have already gone through some examples in the forum (http://www.telerik.com/community/forums/silverlight/gridview/ui-suggestion.aspx , http://www.telerik.com/community/forums/silverlight/gridview/complete-style-and-template-change-help.aspx) but these don't do exactly what I want.
Any help would be appreciated.
Expression Blend MVP
6 Answers, 1 is accepted
Indeed this is the right approach. If you want to override the default behavior you should predefine the template of the GridViewHeaderCell and manipulate the Visibility of the filtering drop down in the corresponding states-MouseOver and Sorting(Ascending/Descending). Regarding your second queston about showing the icon when the filter is applied - since the filter is not visible when the filter is applied you should manually access this element and manipulate it in the way you need.
I am attaching you sample project which demonstrates how this can be achieved.
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
There are a number of things not working as I would like them to.
1. The filter icon is always visible when a column is sorted. I want the filtering icon to have the same behavior whether an column is sorted or not. I only want the icon to be visible when no mouseover, that is when filtering is applied.
2. How would I go about accessing the filter icon manually? I don't see that in your attached example.
Expression Blend MVP
It should always be displayed when a filter is defined and only show up on mouse over if no filter is defined.
Is there a set of styles / templates and code available that acheives this completely?
When you hover over the header cell the filter icon is displayed and when you click on it, filter window is shown. but usually you don't see the filter window the first time itself and by the time you hover on to the filter popup window, the window vanishes as the state is back to normal.
So, I guess the answer to this issue is:
"This should be possible, but we are not sure how to fully implement it. This feature is not part of the control. Perhaps someone will share a working implementation some day."