BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
Hi Muhammad,
Thanks for your interest in Syncfusion products.
Currently we don’t have any custom
events to notify through the “Save” button of default AppointmentEditor when
create/edit the ScheduleAppointments.
But we are able to use our own
editor instead of the default “AppointmentEditor”, so that we are able to achieve
your requirement of get/set values from it. For that please refer the sample in
the below location.
Dashboard - > WinRT -> Schedule
– Customization Demo
If the provided solution doesn’t meet your requirement,
please revert us back with more information about your requirement, so that we
could analyse on it and provide you possible solution.
Regards,
Joy
Oyiess Rex K
Hi Muhammad,
We are working on your requirement in sample level. We will
update you the solution in two business days(January 30,2014).
Please let us know if you need any further clarifications.
Regards,
Saravanan A
Hi Muhammad,
Sorry for the delay in getting back to you.
Please find the response for you requirement.
Requirement of showing First Name and Last Name in
Custom Editor:
Since your
requirement of showing Location and Meeting Purpose detail of the meeting created in schedule can
be set to through the Location and Notes property of ScheduleAppointment
respectively. But the requirement to show First and Last Name there is no any
specific properties in ScheduleAppointment. So for achieving this create a
custom appointment class inheriting “ScheduleAppointment” containing these two
properties as like below code snippet.
C# Code(Custom appointment class):
public class Appointment : ScheduleAppointment
{
#region Public Properties
public string FirstName { get; set; }
public string LastName { get; set; }
#endregion
}
Use the above class for creating appointments in schedule as
like below code snippet.
C# Code(For adding custom appointments in schedule):
Appointment newappointment = new Appointment();
newappointment.StartTime = DateTime.Now.Date.AddHours(9);
newappointment.EndTime = DateTime.Now.Date.AddHours(10);
newappointment.FirstName = "John";
newappointment.LastName = "R";
newappointment.Subject = "Meeting";
newappointment.Location = "Office";
newappointment.Notes = "Need
to collect Project Requirement";
schedule.Appointments.Add(newappointment);
Requirement to show custom Add/Edit appointment panel:
In order to show the custom Editor in schedule. We need to create a
custom editor control class and need to design the style based on the requirement
as like we have done in the attached sample. Please refer the below code
snippet.
C# Code(For creating custom editor control):
public class NewCustomEditor : Control
{
#region Constructor
public NewCustomEditor()
{
this.DefaultStyleKey = typeof(NewCustomEditor);
this.UpdateLayout();
}
#endregion
.
.
.
.
}
Xaml Code(For styling created custom editor control):
<Style x:Key="Editor" TargetType="local:NewCustomEditor">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="local:NewCustomEditor">
<Grid Background="{TemplateBinding
Background}" >
.
.
.
.
</Setter>
</Style>
Adding Custom editor in sample and handling the
visibility of it in Appointment opening event of Schedule:
In order to hide the default editor and show custom editor instead
of it. We need add the custom editor control in sample along with schedule and
need to handle the visibility of the custom editor in appointment opening event
as like in the below code.
Xaml Code(For adding the created custom editor control in sample):
<Grid Background="{StaticResource
ApplicationPageBackgroundThemeBrush}">
<syncfusion:SfSchedule Background="White" x:Name="Schedule" ScheduleType="Week" AppointmentEditorOpening="SfSchedule_AppointmentEditorOpening_1"/>
<!--Adding the custom editor control and applying the
created style to it-->
<local:NewCustomEditor Visibility="Collapsed" x:Name="customeEditor" Grid.ColumnSpan="2" Grid.Row="1" Style="{StaticResource Editor}"/>
</Grid>
C# Code(For handling the visibility of the editor in appointment
opening event):
private void
SfSchedule_AppointmentEditorOpening_1(object sender, Syncfusion.UI.Xaml.Schedule.AppointmentEditorOpeningEventArgs e)
{
if (e.Action == EditorAction.Add)
{
//For avoid showing of default editor
e.Cancel = true;
//new appointment is created and setting the created
appointment as data context to the custom editor control. After that control visibility
is set to Visible
Appointment newappointment = new Appointment();
newappointment.StartTime = e.StartTime;
newappointment.EndTime = e.StartTime.AddMinutes(60);
AddAppointment(newappointment);
}
else if (e.Action == EditorAction.Edit)
{
//For avoid showing of default editor
e.Cancel = true;
//Setting the selected appointment as data context to the
custom editor control. After that control visibility is set to Visible
EditAppointment((Appointment)e.Appointment);
}
}
Based on your requirement we have created sample similar with
the above mentioned changes and you can download the sample from below attachment.
Please let us know if you need any further clarifications.
Regards,
Saravanan A