Programmatically scrolling the scheduleview

2 posts, 0 answers
  1. Daniel
    Daniel avatar
    34 posts
    Member since:
    Oct 2011

    Posted 09 Feb 2012 Link to this post

    As title says, is it possible to scroll the scheduleview horizontally and/or vertically from code-behind in WPF?

    As you can probably appreciate the scrollbars provided by the scheduleview are a little too small for a touchscreen application I'm working on so I'd like the user to be able to navigate around a scheduleview some other way.

    EDIT: I should note that it's important for the user to be able to scroll despite the fact that I'm using resources for grouping. Basically - to provide the functionality the scrollbars do at the moment.
  2. Daniel
    Daniel avatar
    34 posts
    Member since:
    Oct 2011

    Posted 09 Feb 2012 Link to this post

    I've sorted this myself now. For anyone struggling on the same concept - simply use the HorizontalOffset and VerticalOffset properties of the scheduleview in accordance with the touch motion:

            private void radScheduleView1_TouchMove(object sender, TouchEventArgs e)
            {
                    var Touch = e.GetTouchPoint(this);
     
                    Int32 touchToMovementRatio = 30;
     
                    if (TouchStart != null && Touch.Position.X < TouchStart.Position.X)
                    {
                        sv.HorizontalOffset -= (Touch.Position.X - TouchStart.Position.X) / touchToMovementRatio;
                    }
     
                    if (TouchStart != null && Touch.Position.X > TouchStart.Position.X)
                    {
                        sv.HorizontalOffset += (TouchStart.Position.X - Touch.Position.X) / touchToMovementRatio;
                    }
     
                    if (TouchStart != null && Touch.Position.Y < TouchStart.Position.Y)
                    {
                        sv.VerticalOffset -= (Touch.Position.Y - TouchStart.Position.Y) / touchToMovementRatio;
                    }
     
                    if (TouchStart != null && Touch.Position.Y > TouchStart.Position.Y)
                    {
                        sv.VerticalOffset += (TouchStart.Position.Y - Touch.Position.Y) / touchToMovementRatio;
                    }
     
                e.Handled = true;
            }
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top