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

Programmatically scrolling the scheduleview

1 Answer 66 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 09 Feb 2012, 09:39 AM
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.

1 Answer, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 1
answered on 09 Feb 2012, 01:05 PM
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;
        }
Tags
ScheduleView
Asked by
Daniel
Top achievements
Rank 1
Answers by
Daniel
Top achievements
Rank 1
Share this question
or