Hi,
I use a RadGridView and I need to apply a style to the filtered elements. Currently, they disappear off course. Is there a way to set a property "visible" and a forecolor specific ? Like this :
http://image.noelshack.com/fichiers/2015/47/1448027537-2217-noelpush.png
Thanks !
Regards.
8 Answers, 1 is accepted
In general, irrelevant to whether you have filtered the Items of RadGridView or not, you can benefit from the RowStyleSelector / CellStyleSelector functionality that the control supports. You can also check out the StyleSelectors section of RadGridView's online demos or their WPF equivalents.
Let me know should you need further assistance.
Best Regards,
Stefan
Telerik
Hi Stefan,
Thank you for your answer but I don't understand. I tried to apply the RowStyleSelector with the red/yellow backgrounds and I can reproduce the example in my project.
But the style isn't applied to the filtered rows. I created a GridViewRowStyle like this for check :
<
Style
x:Key
=
"GridViewRowStyle"
TargetType
=
"telerik:GridViewRow"
>
<
Setter
Property
=
"Visibility"
Value
=
"{Binding RowVisibility}"
/>
</
Style
>
And in my class StadiumCapacityStyle, the method SelectStyle is called when I use a filter, ok. The issue is that I can see only the rows with a RowVisibility property equals to Visibility.Visible and which corresponds to the criteria of my filter. The filtered rows which are hidden can't receive the style BigStadiumStyle or SmallStadiumStyle. Do you see what I mean ?
Regards.
Hi,
I found a solution. I subscribed to the "Filtered" event and I call the method this.RadGridView.FilterDescriptors.Clear();
I can retrieve the filter criterias in my viewmodel then manually apply a style (with RowStyleSelector) to my items. Thanks for your help !
Regards.
Regards.
In general, modifying the Visibility of the visual elements of the control is something that we do not recommend. RadGridView is a virtualized component and using it in such way can lead to unpredictable results. You can take a look at the UI Virtualization topic for more information.
Can you please share some details on your requirements and why do you need to apply a style to an element that is not visible?
Regards,
Stefan
Telerik
Hi Stefan,
In an other thread, I explained that I'm creating a control with a RadGridView which has a "zoom", like this :
http://image.noelshack.com/fichiers/2015/47/1447859201-5988-noelpush.png
And when I use a filter, several rows disappear and the spacing between the rows becomes wrong (the chronology is broken, actually). So I need that the rows stay visible, because the height of every cell is important, but the text must be hidden for that the user sees only the rows which correspond to the criterias.
So now in my code, I continue to use the interface of the filters provided by the RadGridView (the little windows with the field filters and the distinct filters), but I prevent the control to filtering the data, and I call in place an algorithm which applies to each value of my collection an opacity of 0 or 1. This was not very practical to establish but it works...
Sorry for my english.
Regards.
This is an illustration :
http://image.noelshack.com/fichiers/2015/48/1448629402-8935-noelpush.png
As this requirement is a little bit specific, I am afraid that there is no out-of-the-box approach that I can suggest you for achieving it. A possible solution would be to either use the logic you have already implemented, or try using a RowStyleSelector and set the Foreground of a given row to transparent("#00000000").
Regards,
Stefan
Telerik