Multiple AppointmentDialogStyle for different Appointment Types

1 Answer 84 Views
ScheduleView
Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
Ohad asked on 09 Feb 2023, 02:55 PM | edited on 09 Feb 2023, 03:14 PM

I have a Class Aa that inherits from Appointment and in addition, I have created Classes Bb and Cc.

Class Aa contains two properties, BbProperty and CcProperty.

This logic is to be able to work with two different types of appointments.

My goal is to be able to give one custom EditDialog when Aa.BbProperty is pressed 

And another custom EditDialog when Aa.CcProperty is pressed.

I can distinguish when its BbProperty and when its CcProperty as you can see in the picture,

That I created a different template for each of them.

I was able to change properties of the DialogWindow like background,

But I want a completely different template for each of the types.

I am attached my example project here,

Would appreciate help,

Thanks

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 13 Feb 2023, 09:11 AM

Hello Ohad,

One way to achieve your requirement is to use the EditAppointmentDialogStyle property of RadScheduleView. The Style will allow you to change the dialog properties and also its ControlTemplate if needed. You can define different Styles for the different appointment types. Then, you can use the AppointentEditing event to assign the EditAppointmentDialogStyle property to the corresponding style instance. For example:

private Style defaultEditAppointmentDialogStyle;
private void RadScheduleView_Loaded(object sender, RoutedEventArgs e)
{
	var scheduleView = (RadScheduleView)sender;
	this.defaultEditAppointmentDialogStyle = scheduleView.EditAppointmentDialogStyle;
}
		
private void RadScheduleView_AppointmentEditing(object sender, AppointmentEditingEventArgs e)
{
	var appointment = e.Appointment;
	var scheduleView = (RadScheduleView)sender;
	
	if (appointment is of type A) 
	{
		scheduleView.EditAppointmentDialogStyle = styleForTypeA;
	}
	else if (appointment is of type B)
	{
		scheduleView.EditAppointmentDialogStyle = styleForTypeB;
	}
	else 
	{
		scheduleView.EditAppointmentDialogStyle = this.defaultEditAppointmentDialogStyle;
	}
}

I hope that helps.

Regards,
Martin Ivanov
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
ScheduleView
Asked by
Ohad
Top achievements
Rank 3
Bronze
Iron
Iron
Answers by
Martin Ivanov
Telerik team
Share this question
or