ScrollTimeRuler Doesn't work in a MVVM Scenario

4 posts, 1 answers
  1. Brian Foster
    Brian Foster avatar
    3 posts
    Member since:
    Aug 2009

    Posted 17 Jan 2013 Link to this post

    Hello,
    WPF controls version: 2012.2.0912.40

    I'm attempting to create one (1) scheduleview for multiple employees.  (We're using the Day and Week View Definitions only). The goal is to be able to view different "Work Schedules" of several employees. So if I check the employee's name, the scheduleview should only display that employee's work schedule (i.e,. 8am to 5pm, or 9am to 6pm, etc). I can do this fine in code behind using the ScrollTimeRuler(just as a sample), but we are using MVVM and I do not see a way to call ScrollTimeRuler from my ViewModel.

    Is this possible? and/or do you have any suggestions or samples?

    Thanks,
    Brian Foster
  2. Answer
    Yana
    Admin
    Yana avatar
    4554 posts

    Posted 22 Jan 2013 Link to this post

    Hi Brian,

    ScrollTimeRuler method can be called only with the ScheduleView instance. I am not sure how exactly you're switching the employees ( I guess that they are resources), but if you're using commands you can bind CommandParameter to the ScheduleView and in this way get the control in the ViewModel. Here is a quick example:

    <telerik:RadScheduleView x:Name="scheduleView"  AppointmentsSource="{Binding Appointments}">
    ...
    <telerik:RadScheduleView>
    ...
    <Button Command="{Binding ShowJohnAppointmentsCommand}" CommandParameter="{Binding ElementName=scheduleView}" Content="Show John's Appointments" />

    and in the ViewModel:

    protected void ShowJohnAppointmentsCommandExecuted(object param)
    {
        var scheduleView = param as RadScheduleView;
        scheduleView.ScrollTimeRuler(TimeSpan.FromHours(10), true, true);
    }

    Hope this helps.

    All the best,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. UI for WPF is Visual Studio 2017 Ready
  4. Brian Foster
    Brian Foster avatar
    3 posts
    Member since:
    Aug 2009

    Posted 24 Jan 2013 Link to this post

    Thank you Yana,
    This does help, but I'm still experiencing 1 issue. When I click the command button, it doesn't automatically scroll (top/left); even after setting the top/left parameter to true. I have to hit the button twice in order for it to respond appropriately. Any thoughts on that?

  5. Yana
    Admin
    Yana avatar
    4554 posts

    Posted 29 Jan 2013 Link to this post

    Hi Brian,

    I cannot reproduce this strange behavior at our side. Is it possible to open a support ticket and send us a sample runnable project, so we to be able to research the issue further?

    Thanks in advance.

    Regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top