Gesture to scroll on a RadPageView

3 posts, 1 answers
  1. QuizzBox
    QuizzBox avatar
    46 posts
    Member since:
    Jan 2011

    Posted 28 Oct 2015 Link to this post

    Hi, 

    I currently develop an application on Windows 10 on a tactile device uses a RadPageView (explorerBar mode).

    I want to use gesture to control the scroll, i set the enableGesture to Pan.

    And in PanGesture event, i have the code :

       

    If CType(CType(sender, RadPageView).GetChildAt(0).GetChildAt(3), Telerik.WinControls.UI.RadScrollBarElement).Visibility = ElementVisibility.Visible Then
              If CType(CType(sender, RadPageView).GetChildAt(0).GetChildAt(3), Telerik.WinControls.UI.RadScrollBarElement).Value + e.Offset.Height >= CType(sender, RadPageView).VerticalScroll.Minimum And _
                 CType(CType(sender, RadPageView).GetChildAt(0).GetChildAt(3), Telerik.WinControls.UI.RadScrollBarElement).Value + e.Offset.Height <= CType(sender, RadPageView).VerticalScroll.Maximum Then
                  CType(sender, RadPageView).VerticalScroll.Value = CType(CType(sender, RadPageView).GetChildAt(0).GetChildAt(3), Telerik.WinControls.UI.RadScrollBarElement).Value + e.Offset.Height
              End If
              CType(CType(sender, RadPageView).GetChildAt(0).GetChildAt(3), Telerik.WinControls.UI.RadScrollBarElement).Value += e.Offset.Height
          End If

    Only the scroll bar moves, not the control

     Thanks for your help :)

    NB : I'm using Q1-2015

  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    1404 posts

    Posted 30 Oct 2015 Link to this post

    Hi Nermond,

    Thank you for writing.

    You need to call the InvalidateMeasure method in order to properly update the view after the scroll value is set:
    Private Sub radPageView1_PanGesture(ByVal sender As Object, ByVal e As Telerik.WinControls.PanGestureEventArgs)
        Dim el As RadPageViewExplorerBarElement = TryCast(Me.radPageView1.ViewElement, RadPageViewExplorerBarElement)
     
        If el.Scrollbar.IsElementVisible Then
            e.Handled = True
            If e.Offset.Height > 0 AndAlso el.Scrollbar.Value + 10 < el.Scrollbar.Maximum Then
                el.Scrollbar.Value += 10
                el.InvalidateMeasure()
            End If
            If e.Offset.Height < 0 AndAlso el.Scrollbar.Value - 10 >= 0 Then
                el.Scrollbar.Value -= 10
                el.InvalidateMeasure()
            End If
        End If
    End Sub

    Please let me know if there is something else I can help you with. 
     
    Regards,
    Dimitar
    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 WinForms is Visual Studio 2017 Ready
  4. QuizzBox
    QuizzBox avatar
    46 posts
    Member since:
    Jan 2011

    Posted 30 Oct 2015 in reply to Dimitar Link to this post

    Many thanks, works like a charm :)
Back to Top