ScrollChanged event handler with controlling of child in RadGridView template

2 posts, 0 answers
  1. Khor
    Khor avatar
    3 posts
    Member since:
    Mar 2015

    Posted 05 Apr 2015 Link to this post

    Hi, I encounter a problem about calling the event handler of the scrollviewer inside radgridview template in a style .xaml file.
     I have a radgridview which refer to a basic style in another style xaml file. And the its content is several column build up a table

    ========== page1.xaml ============

    <telerik:RadGridView x:Name = "rgv1" Style="{StaticResource BasicRGVStyle}">

         <telerik:RadGridViewColmns>
               <   ...   few columns ...>
         </telerik:RadGridViewColumns>

    </telerik:RadGridView>



    and this styling has its template as scrollviewer (when the row or column exceed the viewport, scroll bar appear)

    ========== BasicStyle.xaml ==========

    <Style x:Key="BasicRGVStyle" TargetType="telerik:RadGridView">

         <Setter Property="Template">
              <Setter.Value>

                   <ControlTemplate TargetType="{x:Type telerik:RadGridView}">

                         ...

                         <telerik:GridViewScrollViewer x:Name="PART_ItemScrollViewer" Grid.Row="1" ScrollChanged="PART_ItemsScrollViewerChanged">

                         </telerik:GridViewScrollViewer>

                         <Border x:Name="Border1" Grid.Row="2" ...>

                                    ...

                          </Border>

    </Style>


    Can I call PART_ItemsScrollViewerChanged event handler in my page1.xaml.cs and i want to control the border inside this event handler. I recall that it prompt some error some sort like no such event handler found and object reference error.

    Tell me if you can't understand my question. Thanks

  2. Dimitrina
    Admin
    Dimitrina avatar
    3769 posts

    Posted 07 Apr 2015 Link to this post

    Hi Khor,

    Once RadGridView is loaded (for example you can subscribe for its Loaded or DataLoaded event), you should be able to find the corresponding elements in the control's template. You can use the ChildrenOfType extension method to find all children of type GridViewScrollViewer currently available.

    Regards,
    Dimitrina
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top