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

Scrolling Programatically in Q3

5 Answers 40 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Marco
Top achievements
Rank 1
Marco asked on 07 Jan 2010, 02:15 PM

Good morning

I am developing an application WPF touchscreen, I need to have scrolling programatically.
The example 117850_117835 if it works to me, but with Q3 displays error in the following line.

Panel = Me.RadGridView1.ItemsControl.VirtualizingPanel

'temsControl' is not a member of 'Telerik.Windows.Controls.RadGridView'
As it works in the Q3

Thanks

5 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 07 Jan 2010, 02:35 PM
Hi Marco,

Can you post the thread with the project?

All the best,
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.
0
Marco
Top achievements
Rank 1
answered on 07 Jan 2010, 03:08 PM

Imports

 

System

 

Imports

 

System.Collections.Generic

 

Imports

 

System.Linq

 

Imports

 

System.Text

 

Imports

 

System.Windows

 

Imports

 

System.Windows.Controls

 

Imports

 

System.Windows.Data

 

Imports

 

System.Windows.Documents

 

Imports

 

System.Windows.Input

 

Imports

 

System.Windows.Media

 

Imports

 

System.Windows.Media.Imaging

 

Imports

 

System.Windows.Navigation

 

Imports

 

System.Windows.Shapes

 

Imports

 

Telerik.Windows.Controls.GridView

 

Imports

 

System.Windows.Controls.Primitives

 

Namespace

 

ScrollingProgramatically

 

 

''' <summary>

 

 

''' Interaction logic for Window1.xaml

 

 

''' </summary>

 

 

Partial Public Class Window1

 

 

Inherits Window

 

 

Private _Panel As New GridViewVirtualizingPanel

 

 

Private Property Panel() As GridViewVirtualizingPanel

 

 

Get

 

 

Return _Panel

 

 

End Get

 

 

Set(ByVal value As GridViewVirtualizingPanel)

 

_Panel = value

 

End Set

 

 

End Property

 

 

Public Sub New()

 

InitializeComponent()

 

Dim ColMessage As New System.Collections.Generic.List(Of Message)

 

 

Dim Mensaje1 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

Dim Mensaje2 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

Dim Mensaje3 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

Dim Mensaje4 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

Dim Mensaje5 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

Dim Mensaje6 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

Dim Mensaje7 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

Dim Mensaje8 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

Dim Mensaje9 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

Dim Mensaje10 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

Dim Mensaje11 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

Dim Mensaje12 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

Dim Mensaje13 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

Dim Mensaje14 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

Dim Mensaje15 As New Message("tom@hanna-barbera.com", "Cats are cool", 100)

 

 

ColMessage.Add(Mensaje1)

ColMessage.Add(Mensaje2)

ColMessage.Add(Mensaje3)

ColMessage.Add(Mensaje4)

ColMessage.Add(Mensaje5)

ColMessage.Add(Mensaje6)

ColMessage.Add(Mensaje7)

ColMessage.Add(Mensaje8)

ColMessage.Add(Mensaje9)

ColMessage.Add(Mensaje10)

ColMessage.Add(Mensaje11)

ColMessage.Add(Mensaje12)

ColMessage.Add(Mensaje13)

ColMessage.Add(Mensaje14)

ColMessage.Add(Mensaje15)

 

RadGridView1.ItemsSource = ColMessage

 

AddHandler Me.Loaded, AddressOf Window1_Loaded

 

 

End Sub

 

 

Private Sub Window1_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs) Handles Me.Loaded

 

_Panel =

Me.RadGridView1.ItemsControl.VirtualizingPanel

 

 

AddHandler Panel.SizeChanged, AddressOf Panel_SizeChanged

 

 

End Sub

 

 

Sub Panel_SizeChanged(ByVal sender As Object, ByVal e As SizeChangedEventArgs)

 

_Panel.SetHorizontalOffset(0)

 

End Sub

 

 

Private Sub ScrollDown_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

 

_Panel.LineDown()

 

'Use PageDown to move by page

 

 

End Sub

 

 

Private Sub ScrollUp_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

 

_Panel.LineUp()

 

'Use PageUp to move by page

 

 

End Sub

 

 

Private Sub ScrollRight_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

 

_Panel.SetHorizontalOffset(Panel.HorizontalOffset + GetHorizontalScrollOffset())

 

End Sub

 

 

Private Sub ScrollLeft_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)

 

 

If _Panel.HorizontalOffset <= 0 Then

 

 

Return

 

 

End If

 

_Panel.SetHorizontalOffset(Math.Max(Panel.HorizontalOffset - 10, 0))

 

End Sub

 

 

Private Function GetHorizontalScrollOffset() As Double

 

 

If Me._Panel.ExtentWidth <= Me._Panel.ViewportWidth Then

 

 

Return 0

 

 

End If

 

 

Dim nextOffset As Double = Panel.HorizontalOffset + Panel.ViewportWidth + 10

 

 

If nextOffset > Panel.ExtentWidth Then

 

 

Return Panel.ExtentWidth - Panel.HorizontalOffset - Panel.ViewportWidth

 

 

Else

 

 

Return 10

 

 

End If

 

 

End Function

 

 

End Class

 

End

 

Namespace

 

0
Pavel Pavlov
Telerik team
answered on 08 Jan 2010, 01:38 PM
Hello Marco,

Here is a sample code snippet that would programmatically increase the scroll position with 100 .
GridViewScrollViewer viewer = this.RadGirdView1.ChildrenOfType<GridViewScrollViewer>[0];

viewer.ScrollToVerticalOffset(viewer.VerticalOffset + 100);

Hope you find it useful.

All the best,
Pavel Pavlov
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.
0
Marco
Top achievements
Rank 1
answered on 08 Jan 2010, 03:31 PM
Thanks

But in Q3 the RadGridView does not have the event ' ChildrenOfType'
Error 'ChildrenOfType' is not a member of 'Telerik.Windows.Controls.RadGridView'
0
Vlad
Telerik team
answered on 11 Jan 2010, 07:16 AM
Hi Marco,

ChildrenOfType is extension methods in Telerik.Windows.Controls namespace - you need to register this namespace.

Sincerely yours,
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.
Tags
GridView
Asked by
Marco
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Marco
Top achievements
Rank 1
Pavel Pavlov
Telerik team
Share this question
or