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

ScrollTimeRuler Doesn't work in a MVVM Scenario

3 Answers 68 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Brian Foster
Top achievements
Rank 1
Brian Foster asked on 17 Jan 2013, 05:25 PM
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

3 Answers, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 22 Jan 2013, 12:20 PM
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.

0
Brian Foster
Top achievements
Rank 1
answered on 24 Jan 2013, 07:02 PM
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?

0
Yana
Telerik team
answered on 29 Jan 2013, 09:36 AM
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.

Tags
ScheduleView
Asked by
Brian Foster
Top achievements
Rank 1
Answers by
Yana
Telerik team
Brian Foster
Top achievements
Rank 1
Share this question
or