We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

SfSchedule Add/Edit appointment panel

Hello Joy,

I do some changes in SfSchedule Add/Edit appointment panel according to my requirement. Now plz guid me how can I get textbox, checkbox etc values at Save button click??


thanks

7 Replies

MM Muhammad Mobeen January 21, 2014 09:26 AM UTC

Hello Joy,

Also how can I set my parameter values with Add/Edit appointment panel controls in Edit mode.

thanks


JO Joy Oyiess Rex  K Syncfusion Team January 23, 2014 04:43 AM UTC

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



MM Muhammad Mobeen January 27, 2014 10:19 AM UTC

Hello Joye,

Customization Demo is helping me. But as I stated before that I am fresh in Xaml and syncfusion so its code little be confusing me. Can you provide me a sample code with 4 textbox (FirstName, LastName, Location, MeetingPurpose) with Add/Edit functionality.


thanks


SA Saravanan A Syncfusion Team January 28, 2014 09:30 AM UTC

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



MM Muhammad Mobeen February 4, 2014 05:39 AM UTC

Hi Saravanan A,

I still waiting your reply. 

thanks


SA Saravanan A Syncfusion Team February 4, 2014 01:07 PM UTC

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



Custom_editor_5d895733.zip


MM Muhammad Mobeen February 11, 2014 06:02 AM UTC

Hello Saravanan,

Thanks for your help. Your provided code is exactly what I need.

Thanks again.

regards

Loader.
Live Chat Icon For mobile
Up arrow icon