How to apply a style on filtered rows ?

9 posts, 0 answers
  1. Ludovic
    Ludovic avatar
    9 posts
    Member since:
    Oct 2015

    Posted 20 Nov 2015 Link to this post

    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.

  2. Stefan X1
    Admin
    Stefan X1 avatar
    514 posts

    Posted 24 Nov 2015 Link to this post

    Hi Ludovic,

    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
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WPF is Visual Studio 2017 Ready
  4. Ludovic
    Ludovic avatar
    9 posts
    Member since:
    Oct 2015

    Posted 24 Nov 2015 Link to this post

    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.

  5. Ludovic
    Ludovic avatar
    9 posts
    Member since:
    Oct 2015

    Posted 25 Nov 2015 in reply to Ludovic Link to this post

    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.

  6. Ludovic
    Ludovic avatar
    9 posts
    Member since:
    Oct 2015

    Posted 25 Nov 2015 in reply to Ludovic Link to this post

    However, I must admit that recode the filtering system is a bit tedious, because I need currently browse through the items one by one and see if they match the criteria. If there exists a method that would allow me to simply change the rows filtered "Hidden" instead of "Collapsed", i'll take it.

    Regards.
  7. Stefan X1
    Admin
    Stefan X1 avatar
    514 posts

    Posted 27 Nov 2015 Link to this post

    Hi Ludovic,

    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
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. Ludovic
    Ludovic avatar
    5 posts
    Member since:
    Jul 2015

    Posted 27 Nov 2015 Link to this post

    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.

  9. Ludovic
    Ludovic avatar
    5 posts
    Member since:
    Jul 2015

    Posted 27 Nov 2015 Link to this post

    This is an illustration :

    http://image.noelshack.com/fichiers/2015/48/1448629402-8935-noelpush.png

  10. Stefan X1
    Admin
    Stefan X1 avatar
    514 posts

    Posted 02 Dec 2015 Link to this post

    Hi Ludovic,

    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
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for WPF is Visual Studio 2017 Ready