Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Scheduler and Reminder > Read Only appointments

Answered Read Only appointments

Feed from this thread
  • AMF avatar

    Posted on Jan 10, 2012 (permalink)

    Hi all,

    Is there a way to show the appointment edit dialog in read-only when an appointment has the property AllowEdit set to false, instead of not showing the edit dialog at all.

    The problem is that it isn't possible to see all the information of the appointment.

    Greetings

    Reply

  • Answer Ivan Todorov Ivan Todorov admin's avatar

    Posted on Jan 12, 2012 (permalink)

    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

    SP1 of Q3’11 of RadControls for WinForms is available for download (see what's new).

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / WinForms > Scheduler and Reminder > Read Only appointments
Related resources for "Read Only appointments"

[ Features | Demos | Documentation | Knowledge Base | Telerik TV | Code Library | Step-by-step Tutorial | Blogs | Self-Paced Trainer ]