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

Scroll Event - Not Firing... Correct Event??

6 Answers 544 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Sean Overman
Top achievements
Rank 1
Sean Overman asked on 21 Apr 2011, 01:56 AM
Here's my situation.

I have grouped view (dayview) with only 2 resources visible at a time.  If I add 3 resources to the scheduler, I end up with a horizontal scrollbar to scroll between the 3 resources, keeping 2 on the screen at a time.  This is fine, and works correctly.

However, I am modifying the SchedulerCellElement's to suit my business needs, so when I take an action on the schedule, I rebuild the view with custom background colors, etc.

Now when I scroll the view, it appears that its reformatting and repainting the whole schedule view element.  That's fine as well.  But I cannot seem to find the event for this, so that I can attach to that, and reapply my business logic to the view element.

The RadScheduler exposes a Scroll Event, but it doesn't seem to fire.

What I am missing here??

6 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 21 Apr 2011, 01:08 PM
Hi Sean Overman,

The Scroll event you have mentioned comes from the .NET framework base class ScrollableControl and has nothing to do with scrolling through resources. Please refer to the following code snippet for more information on how to subscribe to the desired event:

this.radScheduler1.GroupType = GroupType.Resource;
SchedulerDayViewGroupedByResourceElement dayViewGroupedElement = (this.radScheduler1.SchedulerElement.ViewElement as SchedulerDayViewGroupedByResourceElement);
if(dayViewGroupedElement != null)
{
    dayViewGroupedElement.HScrollBar.ValueChanged+=new EventHandler(HScrollBar_ValueChanged);
}

I hope this helps. Feel free to contact me if you have any additional questions.

Best wishes,
Ivan Todorov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
Sean Overman
Top achievements
Rank 1
answered on 28 Apr 2011, 11:43 PM
Attaching to this event works fine, expect if I set the Views "RulerStartScale" or "RuleEndScale" after that, if rebuilds the whole viewelement and wipes out my event handler.
0
Ivan Todorov
Telerik team
answered on 04 May 2011, 09:27 AM
Hi Sean,

When changing these properties, the scrollbar is recreated and the new scrollbar does not have an event handler. Since there is a lack of notifications for this kind of events, the only thing I can suggest is to subscribe to the scrollbar's ValueChanged after you have set RulerStartScale or RuleEndScale properties.

I have created a PITS item about improving this functionality so you and other people can vote for it. We will consider implementing it in future releases. Here you can find the PITS Issue: Public URL

I hope this helps. Feel free to write back if you have any additional question.

Best wishes,
Ivan Todorov
the Telerik team
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 Public Issue Tracking system and vote to affect the priority of the items
0
David
Top achievements
Rank 1
answered on 20 Oct 2015, 08:26 AM

Hello
 I have a similar problem and the provided code was really Helpfull but I also need to catch the scroll event of the other scrollbar
 I'm working with TimeLineView and MultidayView in Resource GroupType

Here is the code I'm using :

01.If Me.RadScheduler_PlanningOf.ActiveViewType = SchedulerViewType.Timeline Then
02.            Dim headerElement As Telerik.WinControls.UI.TimelineGroupingByResourcesElement = TryCast(RadScheduler_PlanningOf.SchedulerElement.ViewElement, TimelineGroupingByResourcesElement)
03.            If Not IsNothing(headerElement) Then
04.                AddHandler headerElement.VScrollBar.ValueChanged, AddressOf ScrollBar_ValueChanged
05.            End If
06.        Else
07.            Dim headerElement As SchedulerDayViewGroupedByResourceElement = TryCast(RadScheduler_PlanningOf.SchedulerElement.ViewElement, SchedulerDayViewGroupedByResourceElement)
08.            If Not IsNothing(headerElement) Then
09.                AddHandler headerElement.HScrollBar.ValueChanged, AddressOf HScrollBar_ValueChanged
10.            End If
11.        End If

 

Thanks to you it works fine, but when in timelinewiew it only catches ​Vertical ScrollBar event not the ​Horizontal one (I think it's not related to resources), and when in dayView, only catches Horizontal scrollbar event and not the vertical one.

 

Any Idea ?

 

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 21 Oct 2015, 12:30 PM
Hello David,

Thank you for writing.

Here is a sample code snippet demonstrating how to subscribe to the ValueChanged event for both, vertical and horizontal, scroll bars in RadScheduler in SchedulerViewType.Timeline and grouped by resources. This example is applicable for Q3 2015 version:
Sub New()
 
    InitializeComponent()
 
    Dim colors() As Color = {Color.LightBlue, Color.LightGreen, Color.LightYellow, Color.Red,
                             Color.Orange, Color.Pink, Color.Purple, Color.Peru, Color.PowderBlue}
 
    Dim names() As String = {"Alan Smith", "Anne Dodsworth", "Boyan Mastoni",
                             "Richard Duncan", "Maria Shnaider"}
 
    For i As Integer = 0 To names.Length - 1
        Dim resource As New Telerik.WinControls.UI.Resource()
        resource.Id = New EventId(i)
        resource.Name = names(i)
        resource.Color = colors(i)
        Me.RadScheduler1.Resources.Add(resource)
    Next i
    Me.RadScheduler1.GroupType = GroupType.Resource
    Me.RadScheduler1.ActiveView.ResourcesPerView = 2
    Me.RadScheduler1.ActiveViewType = SchedulerViewType.Timeline
    If Me.RadScheduler1.ActiveViewType = SchedulerViewType.Timeline Then
        Dim timelineElement As Telerik.WinControls.UI.TimelineGroupingByResourcesElement =
            TryCast(RadScheduler1.SchedulerElement.ViewElement, TimelineGroupingByResourcesElement)
        If Not IsNothing(timelineElement) Then
            AddHandler timelineElement.VScrollBar.ValueChanged, AddressOf VScrollBar_ValueChanged
            For Each el As RadElement In timelineElement.Children
                Dim timeLineViewElement As SchedulerTimelineViewElement = TryCast(el, SchedulerTimelineViewElement)
                If timeLineViewElement IsNot Nothing AndAlso timeLineViewElement.NavigationElement.Visibility = ElementVisibility.Visible Then
                    Dim navElement As TimelineScrollNavigationElement =
                        TryCast(timeLineViewElement.NavigationElement, TimelineScrollNavigationElement)
                    AddHandler navElement.FindDescendant(Of RadScrollBarElement).ValueChanged, AddressOf HScrollBar_ValueChanged
                End If
 
            Next
             
        End If
    End If
End Sub
 
Private Sub VScrollBar_ValueChanged(sender As Object, e As EventArgs)
    Console.WriteLine("Vertical scroll-bar changed ")
End Sub
 
Private Sub HScrollBar_ValueChanged(sender As Object, e As EventArgs)
    Console.WriteLine("Horizontal scroll-bar changed ")
End Sub

I hope this information helps. Should you have further questions I would be glad to help.
 
Regards,
Dess
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
0
David
Top achievements
Rank 1
answered on 22 Oct 2015, 06:58 AM
Thanks a lot Dess, it's exactly what I needed.
Tags
Scheduler and Reminder
Asked by
Sean Overman
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Sean Overman
Top achievements
Rank 1
David
Top achievements
Rank 1
Dess | Tech Support Engineer, Principal
Telerik team
Share this question
or