Hello,
Yes, there is a way to achieve this. To do so, you need to override a single method of
RadScheduler and show a custom dialog when editing read-only appointments. The approach is demonstrated below:
public class MyScheduler : RadScheduler
{
public override DialogResult ShowAppointmentEditDialog(IEvent appointment, bool recurringAppointment)
{
if (appointment == null)
return DialogResult.Cancel;
if (!appointment.AllowEdit)
{
IEditAppointmentDialog dialog = this.CreateReadOnlyDialog();
IComponentTreeHandler radComponent = dialog as IComponentTreeHandler;
if (radComponent != null)
radComponent.ThemeName = this.ThemeName;
if (!dialog.EditAppointment(appointment, this))
return DialogResult.Cancel;
return dialog.ShowDialog();
}
else
{
return base.ShowAppointmentEditDialog(appointment, recurringAppointment);
}
}
private IEditAppointmentDialog CreateReadOnlyDialog()
{
return new ReadOnlyEditAppointmentDialog();
}
public override string ThemeClassName
{
get
{
return typeof(RadScheduler).FullName;
}
set
{
base.ThemeClassName = value;
}
}
}
public class ReadOnlyEditAppointmentDialog : EditAppointmentDialog
{
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.txtSubject.ReadOnly = true;
this.txtLocation.ReadOnly = true;
this.textBoxDescription.ReadOnly = true;
this.cmbBackground.Enabled = false;
this.cmbShowTimeAs.Enabled = false;
this.cmbResource.Enabled = false;
this.timeStart.Enabled = this.timeEnd.Enabled = false;
this.dateStart.Enabled = this.dateEnd.Enabled = false;
this.chkAllDay.Enabled = false;
this.buttonCancel.Visible = this.buttonDelete.Visible =
this.buttonRecurrence.Visible = false;
}
protected override void ApplySettingsToEvent(IEvent targetEvent)
{
}
}
I hope you find this useful. Do not hesitate to ask if you have any further questions.
Regards,
Ivan Todorov
the Telerik team