This is a migrated thread and some comments may be shown as answers.

ScrollChanged event handler with controlling of child in RadGridView template

1 Answer 202 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Khor
Top achievements
Rank 1
Khor asked on 05 Apr 2015, 05:33 AM

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

1 Answer, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 07 Apr 2015, 12:16 PM
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.

 
Tags
GridView
Asked by
Khor
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
Share this question
or