16 Answers, 1 is accepted
In order to show the EditAppointmentDialog you can execute the EditAppointment Command of the ScheduleView, for example:
RadScheduleViewCommands.EditAppointment.Execute(appointment,
this
.scheduleView);
Where appointment is the newly created appointment.
Regards,
Konstantina
the Telerik team
but is it possible to show the Appointment Dialog from somewhere else? I have my SchduleView on my Schedule.xaml Page. Somewhere else in my application i want to open the Appointment Dialog.
Is that possible and how?
thanks a lot
Regads
rene
If you have a reference to the ScheduleView and you give that reference to the Command, you should be able to open the dialog from somewhere else.
Regards,
Konstantina
the Telerik team
but how do i set the reference to my scheduleview? Now i use this code to open the appointment (i try).
private
void
test_Click(
object
sender, RoutedEventArgs e)
{
RadScheduleView RSvD =
new
RadScheduleView();
Appointment appoint =
new
Appointment();
RadScheduleViewCommands.EditAppointment.Execute(appoint, RSvD);
}
But i just get an empty box (attached).
Thanks
rene
RadScheduleView MyRadScheduleView = (sender as RadScheduleView);
Appointment appointment = new Appointment();
appointment.Subject = "New Appointment";
appointment.Start = MyRadScheduleView.SelectedSlot.Start;
appointment.End = MyRadScheduleView.SelectedSlot.End;
foreach (Resource r in MyRadScheduleView.SelectedSlot.Resources.AsEnumerable())
{
appointment.Resources.Add(r);
}
RadScheduleViewCommands.CreateAppointment.Execute(appointment, MyRadScheduleView);
But when the EditAppointmentDialog appear, there is no resources selected, how i can selected resources?
Thanks
Gat
my problem ist, the appointment does not appear?!
Thanks
Rene
Gat, could you please explain on which event you are adding the new appointment?
Also, if you could give us some more details about the scenarios in which you experience the issue will be much helpful for tracking down the source of the issue. Sending us a sample application in which is illustrated your approaches and what you need to achieve will help us in providing you with solution in a timely manner.
Looking forward to your replies.
Greetings,
Konstantina
the Telerik team
it's quiet simple. I want to open the appointment dialog from somewhere in my project. Perhaps after cklicking a button.
That's it!
Thanks
Best Regards
Rene
As mentioned earlier, if you have a reference to the ScheduleView and you give that reference to the Command, you should be able to open the dialog from somewhere else.
Greetings,
Konstantina
the Telerik team
I want create a new Custom Appointment after the user has selected a time slot at the Mouse_Up Event, my scheduleView call this method:
private void ScheduleView_MouseUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
if (sender is RadScheduleView)
{
RadScheduleView MyRadScheduleView = (sender as RadScheduleView);
MyAppointment appointment = new MyAppointment
{
Subject = "New Appointment",
Start = MyRadScheduleView.SelectedSlot.Start,
End = MyRadScheduleView.SelectedSlot.End
};
foreach (Resource r in MyRadScheduleView.SelectedSlot.Resources.AsEnumerable())
{
appointment.Resources.Add(r);
}
RadScheduleViewCommands.CreateAppointmentWithDialog.Execute(appointment, MyRadScheduleView);
}
}
But when the CreateAppointmentDialog appear, the ressource is not selected then my appointment then ressources.
I just want my ressources are selected in the CreateAppointmentDialog.
something like this:
Telerik.Windows.Controls.RadScheduleView MyView = new Telerik.Windows.Controls.RadScheduleView();
Telerik.Windows.Controls.RadScheduleViewCommands.CreateAppointmentWithDialog.Execute(null, MyView);
Thanks
rene
# to Mace:
CreateAppointment command expects the first parameter to be of type IDateSpan ( like Slot, for example) - that is why neither of the properties are not set in the dialog. I suggest to call the command like this:
RadScheduleViewCommands.CreateAppointmentWithDialog.Execute(MyRadScheduleView.SelectedSlot, MyRadScheduleView);
and subscribe to AppointmentCreating event and set the Subject of the new appointment in its handler:
private
void
ScheduleView_AppointmentCreating(
object
sender, AppointmentCreatingEventArgs e)
{
e.Appointment.Subject =
"New Appointment"
;
}
in this way the resources will be set without a problem.
#to Rene:
As explained earlier you should set the ScheduleView as a second parameter when using the command. But note that it should be the ScheduleView instance which is placed on the page, not a newly created one.
Hope this helps.
Greetings,
Yana
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Hello,
When i double on the ScheduleView, I want to get the details which was entering in an appointment. Mean to say i wanna store it locally(DB). How to achieve it??
If any examples are there please share me, it may help me to solve this.
Can you please share some more details regarding the desired scenario? Where on the control you want to click? And which appointment exactly you need to get details for? If you mean when double clicking an Appointment, then you could hook to the ShowDialog event of RadScheduleView and extract the currently clicked Appointment from the event arguments.
Hope this helps.
Regards,
Kalin
Telerik
Hello Kalin,
Thanks for the reply. Gone through the ShowDialog and getting the details, but how to achieve it using MVVM architecture, Specifically when ShowDialog opens i wanna save Appointment details to my DB, but i couldn't able to recognize which event is firing. Even i have tried RadScheduleView_AppointmentCreated ,whether it is the correct method or wrong?? If yes, then can we do using MVVM??
Thank You :)
Through the arguments of the event (the ViewMode property of the AppointmentDialogViewModel) you can find out if the dialog is opening for creating a new appointment or for editing an existing one. Please check the following snippet:
private
void
radScheduleView_ShowDialog(
object
sender, ShowDialogEventArgs e)
{
var isAddingNew = (e.DialogViewModel
as
AppointmentDialogViewModel).ViewMode == AppointmentViewMode.Add;
}
You could use our EventToCommand behavior in order to execute a command in the ViewModel whenever the event is fired.
Hope this helps.
Regards,
Kalin
Telerik