Strange behaviour on vertical scrolling

3 posts, 1 answers
  1. Roy Halvorsen
    Roy Halvorsen avatar
    83 posts
    Member since:
    Oct 2008

    Posted 08 Jan 2010 Link to this post

    I have a gridview, using version 2009.3.1208.35 and MVVM. Style and visibility is applied like the following:
            <telerik:RadGridView.Resources> 
                <Style TargetType="{x:Type GridView:GridViewRow}"
                    <Setter Property="Background" Value="#FFFFe1" /> 
                    <Style.Triggers> 
                        <DataTrigger Binding="{Binding Path=OperationId}" Value="0"
                            <DataTrigger.Setters> 
                                <Setter Property="Background" Value="#FFFFFF" /> 
                            </DataTrigger.Setters> 
                        </DataTrigger> 
                        <DataTrigger Binding="{Binding Path=OperationStatus}" Value="9"
                            <DataTrigger.Setters> 
                                <Setter Property="Visibility" Value="Collapsed" /> 
                            </DataTrigger.Setters> 
                        </DataTrigger> 
                    </Style.Triggers> 
                </Style> 
            </telerik:RadGridView.Resources> 
     
    Everything looks fine when the grid is loaded, but, if I scroll vertically, it seems like <Setter Property="Visibility" Value="Collapsed" /> doesn't work anymore. No more rows are collapsed. Is this is a bug, or am I missing something?

    Roy
  2. Answer
    Vlad
    Admin
    Vlad avatar
    11100 posts

    Posted 08 Jan 2010 Link to this post

    Hello Roy,

    I suggest you to use a bit different approach to exclude some items. Here is an example:

            <telerik:RadGridView ItemsSource="{Binding}">
                <telerik:RadGridView.FilterDescriptors>
                    <telerik:FilterDescriptor Member="OperationStatus" Operator="IsNotEqualTo" Value="9" />
                </telerik:RadGridView.FilterDescriptors>
                <telerik:RadGridView.Resources>
                    <Style TargetType="{x:Type telerik:GridViewRow}">
                        <Setter Property="Background" Value="#FFFFe1" />
                        <Style.Triggers>
                            <DataTrigger Binding="{Binding Path=OperationId}" Value="0">
                                <DataTrigger.Setters>
                                    <Setter Property="Background" Value="#FFFFFF" />
                                </DataTrigger.Setters>
                            </DataTrigger>
                        </Style.Triggers>
                    </Style>
                </telerik:RadGridView.Resources>
            </telerik:RadGridView>

    Rows visibility is one of the keys behind the grid virtualization and that is why will not work in such scenarios.

    Regards,
    Vlad
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. UI for WPF is Visual Studio 2017 Ready
  4. Roy Halvorsen
    Roy Halvorsen avatar
    83 posts
    Member since:
    Oct 2008

    Posted 08 Jan 2010 Link to this post

    Thanks a lot :-) It works.
Back to Top