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

How to replace "standard" Appointments Dialog

8 Answers 349 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Gianfranco
Top achievements
Rank 1
Gianfranco asked on 16 Apr 2018, 11:25 AM

Hi

I'm developing a management software for a multi-doctor study.
To organize their appointments I need to fill in the following fields:
Patient - with PatientId
Doctor - with DoctorId
Surgery - With SurgeryId
Service - With Serviceid
Date of appointment
Start date and time
End date and time
and other fields yet.
So, to create an appointment, I need to create an interface that can allow the choice of patients, doctors, surgeries, services from the related tables.

How can I achieve all this?
do I have to go through the custom appointment technique?
or can I replace it with a totally customized interface?
if so, how can I intercept the creation / modification of it?
thank you in advance
Gianfranco

8 Answers, 1 is accepted

Sort by
0
Vladimir Stoyanov
Telerik team
answered on 19 Apr 2018, 10:19 AM
Hello Gianfranco,

You are indeed correct that you can define a custom appointment in order to achieve your requirements. To summarize, you can inherit and extend the Appointment class with the additional fields and then you can define a custom Appointment Dialog. For a reference, please check out the Custom Appointment and Validation RadScheduleView example in our demos

I hope this helps.

Regards,
Vladimir Stoyanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Gianfranco
Top achievements
Rank 1
answered on 19 Apr 2018, 11:31 AM

Hi Vladimir

Thank you for your answer
Unfortunately, I have many concepts that I have yet to learn.
and you have to apologize if I still bother you.
I'm focusing on these crucial steps:
"In order to create a custom appointment" we are going to modify the EditAppointmentDialogStyle property of RadScheduleView control The DataContext of the TargetType of this style is an AppointmentDialogViewModel object This class contains the required data for editing an appointment including the Appointment itself. can be reached by using the Occurrence property of the ViewModel and then the Appointment property of Occurrence Now that we have our custom IsDone property, let's add to CheckBox for it and bind to it First, you need to generate the code for the EditAppointment dialog from Expression Blend.Then, add the following snippet in the ControlTemplate of the dialog: "

Well

I allowed myself to send you an attachment where I explain my difficulties,
I am aware that I might seem unprepared.
But I'm doing everything to document myself without success.
Being the first time I can not find a solution without disturbing you.

thanks again for your patience and availability

 

0
Vladimir Stoyanov
Telerik team
answered on 23 Apr 2018, 12:40 PM
Hello Gianfranco,
 
Thank you for the attached picture.

I have prepared a sample project demonstrating how you can modify the EditAppointmentDialog. I will list the steps I went through for your reference:
  1. I extracted the Style with x:Key="EditAppointmentDialogStyle" and the ControlTemplate with x:Key="EditAppointmentTemplate" from the RadScheduleView styles. You can check the Editing Control Templates article in our documentation for a more detailed explanation on how to do that. In order to avoid using Expression Blend, you can go to the Themes.Implicit\{theme}\Themes in the installation folder of UI for WPF(replace "theme" with the theme that you are using) and locate the "Telerik.Windows.Controls.ScheduleView.xaml" file. 
  2. You can keep only the Template setter of the EditAppointmentDialogStyle, change its key and base it like so:
<Style x:Key="CustomEditAppointmentDialogStyle" TargetType="telerik:SchedulerDialog" BasedOn="{StaticResource EditAppointmentDialogStyle}">
            <Setter Property="Template" Value="{StaticResource CustomEditAppointmentTemplate}"/>
        </Style>

     3. Then you can modify the EditAppointmentTemplate as you wish. I have added a comment in the attached project to indicate where I have made the change.

A couple of final notes: I have added an internal item to update the Custom Appointment article, since I agree that it is a bit confusing. I have updated your telerik points as a small gesture of gratitude for bringing this to our attention.

Please note that the attached project is using Implicit Styles and the NoXaml version of our dlls. The EditAppointmentDialog is extracted from the OfficeBlack theme. If you are using a different theme, you can refer to step 1 in order to extract the correct styles for that theme.

Regards,
Vladimir Stoyanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Gianfranco
Top achievements
Rank 1
answered on 04 May 2018, 04:11 PM

Thanks Vladimir for your availability and valuable help.
Considering that I've never developed wpf project I'm having a lot of trouble.
So, following the steps you listed, I had to deepen useful and necessary concepts.
Unfortunately I still do not have the desired result but, I hope and I think I'm one step away from the solution.
In short:
I created a template that coincidentally suits me the one suggested by you and inserted it in the same xaml of the main project without creating a user control.
too much, both as user control and as a template within my project, I always have the resource available as "DynamicResource" and not as "StaticResource"

so the custom appointment dialog style I declared it as follows:

 <Window.Resources>
        <Style x: Key = "CustomEditAppointmentDialogStyle" TargetType = "telerik: SchedulerDialog" BasedOn = "{StaticResource EditAppointmentDialogStyle}">
            <Setter Property = "Template" Value = "{DynamicResource CustomEditAppointmentTemplate}" />
        </ Style>


<ControlTemplate x: Key = "CustomEditAppointmentTemplate" TargetType = "telerik: SchedulerDialog">
            <Grid IsSharedSizeScope = "True">
                <Grid.RowDefinitions>
                    <RowDefinition Height = "Auto" />
. . . . .
 . . . . .
 ... . .
 . . . .
      </ Grid>
</ ControlTemplate>

just that I do not understand what I have to declare to my RadScheduleView to make sure that it is used my custom appointment dialog view:

  <telerik:RadScheduleView x:Name="scheduleView"  VerticalScrollBarVisibility="Auto" Height="894"  >
  <telerik:RadScheduleView.ViewDefinitions>
                        <telerik:DayViewDefinition  TimerulerMajorTickStringFormat="{}{0:HH}:{0:mm}"

. . . . . 

. . . . 

 

I hope I have explained my problem well

could you give me one last help?
thank you in advance

 

 

 

 

 

 

0
Vladimir Stoyanov
Telerik team
answered on 09 May 2018, 02:20 PM
Hello Gianfranco,

Since you have declared the CustomEditAppointmentDialogStyle with the modified CustomEditAppointmentTemplate, I believe that you only need to set that style to the EditAppointmentDialogStyle property of the RadScheduleView. Here is how that would look:
<telerik:RadScheduleView  EditAppointmentDialogStyle="{StaticResource CustomEditAppointmentDialogStyle}">

An important thing to note is that the project has to be referencing the NoXaml version of the Telerik UI for WPF assemblies in order for the implicit style to work correctly.

Can you give this a try and let me know how it goes?

Regards,
Vladimir Stoyanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Gianfranco
Top achievements
Rank 1
answered on 14 May 2018, 10:29 AM

Hi Vladimir

unfortunately I do not have the skills to quickly understand your suggestions.
In fact, the project crashed several times as well as losing the style of other components throughout the project.
so I opted for another unprofessional solution, but for now effective and allows me to deliver a first release for the month of July.
I'm not at all satisfied with my solution but for now I have to think about delivering this first release.
in short, I explain how I realized what was desired:

I intercepted the events:

RadScheduleView_ShowDialog
scheduleView_AppointmentEditing
scheduleView_AppointmentCreating

in order to display my interface to manage all the fields needed to create the appointment.

for example, for the editing phase:
 private void scheduleView_AppointmentEditing (object sender, AppointmentEditingEventArgs e)
        {
            e.Cancel = true;


            TaskInAgend inAgenda = (TaskInAgend) e.Appointment;

            string gg = inAgenda.UniqueId;

            Agenda agenda = agendaService.GetById (Convert.ToInt32 (gg));
            RadDatePickerForAppointment.CurrentDateTimeText = agenda.StartTime.ToString ();
            RadTimePickerForAppointmentTo.DateTimeText = agenda.StartTime.ToString ();
            txtNotesForAppointment.Text = agenda.Notes.Trim ();
            txtSubjectForAppointment.Text = agenda.Subject.Trim ();

            appointmentPanel.Margin = new Thickness ((mainScreen.WorkingArea.Width / 2) - (appointmentPanel.Width / 2), (mainScreen.WorkingArea.Height / 2) - (appointmentPanel.Height / 2), 0, 0);

        }

 

 

my result is bad for now; but working.
In addition I will also have to change the color of the items of the appointments ....
I can already imagine the thousand difficulties that I will have to solve ..
but I will do it in the next months, after having delivered a first release.
I'm sorry...

thanks again for your availability

 

 

0
Vladimir Stoyanov
Telerik team
answered on 16 May 2018, 03:56 PM
Hello Gianfranco,

I am glad to hear that you managed to achieve what you were going for even though the solution may be suboptimal.

I would really encourage you to examine the attached project since it contains what is necessary to implement a custom appointment. I am uncertain of the exact reason for the crashing of the application and the lost styles on your side. What I can suggest is making sure that all of the referenced dlls are the same version and are also the NoXaml version. Additionally, you can make sure that all of the required xaml files are merged. If you provide some more information about that and the steps you are performing to observe this behavior, I may be able to assist you further.

As for changing the color of the items of the appointments, I would suggest you take a look at the Appointment Style article.

Regards,
Vladimir Stoyanov
Progress Telerik
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Gianfranco
Top achievements
Rank 1
answered on 16 May 2018, 04:12 PM
Thanks again Vladimir
I have to finish important projects well; as soon as I'll be quiet, it will be my interest to deepen your suggestions to be able to customize more elegantly.
Thanks again
Tags
ScheduleView
Asked by
Gianfranco
Top achievements
Rank 1
Answers by
Vladimir Stoyanov
Telerik team
Gianfranco
Top achievements
Rank 1
Share this question
or