Custom Appointment Dialog, or edit the Recurrence Dialog?

18 posts, 0 answers
  1. Tom
    Tom avatar
    3 posts
    Member since:
    Jun 2015

    Posted 17 Jun 2015 Link to this post

    Hi,

    I'm trying to create a customised version of the appointment dialog, which will actually combine some of the functionality of both the EditRecurrence dialog and the EditAppointment dialog.

    From the EditActivity dialog all I need is the start date and subject fields along with the save and cancel buttons, and then from EditRecurrence I want a checkbox to enable recurrence functionality, which will enable the recurrence pattern and range of recurrence groups of controls in the same dialog.

    What would be the best way to implement this window? I've played around with inheriting EditRecurrenceDialog (partial class frmEditAppointment : EditRecurrenceDialog) but I can't seem to hide the controls I don't want. For example when I try to hide the All Day Event checkbox the "Visible" property is greyed out in the designer/properties window and I can't change it to false.

    Given these issues I get the impression I'd be best off creating a new appointment dialog entirely, how should I go about doing this? Ideally I wouldn't want to have to recreate groups of controls like the recurrence pattern or range of recurrence and instead just add/copy them in somehow.

     

     Thanks for your help, Tom.

  2. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 19 Jun 2015 Link to this post

    Hello Tom,

    Thank you for writing.

    You can inherit the EditAppointmentDialog and open the designer. When I select a specific control its Visible property is editable in the Properties window. Please refer to the attached screenshots. However, chkAllDay RadCheckBox is a little bit specific. In the EditAppointmentDialog.Load event the visibility of the RadCheckBox is set to true again. That is why in order to hide it, you should do it via code in the Load event.

    An alternative solution to create a custom edit dialog is to inherit RadSchedulerDialog and implement IEditAppointmentDialog. Thus, you will be able to build the desired design and handle the whole edit operation.

    I hope this information helps. Should you have further questions, I would be glad to help.
     
    Regards,
    Dess
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Tom
    Tom avatar
    3 posts
    Member since:
    Jun 2015

    Posted 22 Jun 2015 in reply to Dess Link to this post

    OK, I'm beginning to think inheriting RadSchedulerDialog and implementing IEditAppointmentDialog would be the cleanest way to proceed.

    Is there an easy way to add the "Recurrence Pattern" and "Range of Recurrence" group of controls to this custom dialog or will I need to code these myself?

     

    Thanks, Tom.

  5. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 22 Jun 2015 Link to this post

    Hello Tom,

    Thank you for writing back.

    Inheriting the basic RadSchedulerDialog class and implementing IEditAppointmentDialog interface gives you the opportunity to construct the desired look for the edit dialog. However, you should implement the whole required functionality for this dialog. I would recommend you to download our source code and have a look at the EditAppointmentDialog class. Thus, you can pay attention to the introduced implementation about recurrence functionality and follow similar approach. Simply you can show the desired recurring dialog when a certain button is clicked.

    I hope this information helps. If you have any additional questions, please let me know.
     
    Regards,
    Dess
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  6. Tom
    Tom avatar
    3 posts
    Member since:
    Jun 2015

    Posted 22 Jun 2015 in reply to Dess Link to this post

    Hi Dess,

    Thanks for your reply. I'm not entirely sure you understand what I'm aiming for - what I'd prefer to have is a single dialog for both appointments and recurring appointments. The bottom of this dialog would be similar to the current recurrence dialog. A checkbox would enable the recurrence related controls. Is this doable without having to build a whole new dialog and recreate all the current control groups from scratch?

     Thanks, Tom.

  7. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 23 Jun 2015 Link to this post

    Hello Tom,

    Thank you for writing back.

    Note that by default RadScheduler displays a specific dialog for manipulating recurring appointments. You are describing a custom edit dialog. Hence, it is not possible to come out of the box and you should build it according to your requirements. Feel free to use one of the suggested approaches from my previous posts. Additionally, you can have a look at the Demo application >> Scheduler >> Custom appointment dialog example which is quite useful on this topic.

    If you have any additional questions, please let me know.
     
    Regards,
    Dess
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  8. Aref
    Aref avatar
    18 posts
    Member since:
    Sep 2015

    Posted 21 Nov 2015 in reply to Dess Link to this post

    Hello sir 
    I am using visual studio 2010 and Telerik UI for WinForms Q2 2015 SP1. I am using Radscheduler in my project and I localized it's labels but everytimes I want to create a recurrence appointment with monthly or yearly recurrence pattern my application crash and throw this exception :
    System.ArgumentException was unhandled
      Message=An item with the same key has already been added.
      Source=mscorlib
      StackTrace:
           at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
           at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
           at Telerik.WinControls.UI.Scheduler.Dialogs.MonthlyRecurrenceSettings.LoadWeekDaysInCombo(RadDropDownList comboBox, ISchedulerData data)
           at Telerik.WinControls.UI.Scheduler.Dialogs.MonthlyRecurrenceSettings.ShowRecurrenceRule(RecurrenceRule recurrenceRule, CultureInfo culture)
           at Telerik.WinControls.UI.Scheduler.Dialogs.EditRecurrenceDialog.radioRecurrenceRule_ToggleStateChanged(Object sender, StateChangedEventArgs args)
           at Telerik.WinControls.UI.RadToggleButton.OnToggleStateChanged(EventArgs e)
           at Telerik.WinControls.UI.RadRadioButton.ButtonElement_ToggleStateChanged(Object sender, StateChangedEventArgs args)
           at Telerik.WinControls.UI.RadToggleButtonElement.OnToggleStateChanged(StateChangedEventArgs e)
           at Telerik.WinControls.UI.RadRadioButtonElement.OnToggleStateChanged(StateChangedEventArgs e)
           at Telerik.WinControls.UI.RadToggleButtonElement.SetToggleStateCore(ToggleState value)
           at Telerik.WinControls.UI.RadToggleButtonElement.SetToggleState(ToggleState value)
           at Telerik.WinControls.UI.RadToggleButtonElement.OnToggle()
           at Telerik.WinControls.UI.RadToggleButtonElement.OnClick(EventArgs e)
           at Telerik.WinControls.UI.RadRadioButtonElement.OnClick(EventArgs e)
           at Telerik.WinControls.RadElement.DoClick(EventArgs e)
           at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
           at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
           at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
           at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
           at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
           at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
           at Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e)
           at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e)
           at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e)
           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
           at Telerik.WinControls.RadControl.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.RunDialog(Form form)
           at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
           at Telerik.WinControls.UI.Scheduler.Dialogs.EditRecurrenceDialog.Telerik.WinControls.UI.Scheduler.Dialogs.IEditRecurrenceDialog.ShowDialog()
           at Telerik.WinControls.UI.Scheduler.Dialogs.EditAppointmentDialog.ShowRecurrenceDialog()
           at Telerik.WinControls.UI.RadScheduler.<>c__DisplayClass3.<ShowAppointmentEditDialog>b__0(Object param0, EventArgs param1)
           at System.Windows.Forms.Form.OnShown(EventArgs e)
           at Telerik.WinControls.UI.Scheduler.Dialogs.EditAppointmentDialog.OnShown(EventArgs e)
           at System.Windows.Forms.Form.CallShownEvent()
           at System.Windows.Forms.Control.InvokeMarshaledCallbackDo(ThreadMethodEntry tme)
           at System.Windows.Forms.Control.InvokeMarshaledCallbackHelper(Object obj)
           at System.Threading.ExecutionContext.runTryCode(Object userData)
           at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
           at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Windows.Forms.Control.InvokeMarshaledCallback(ThreadMethodEntry tme)
           at System.Windows.Forms.Control.InvokeMarshaledCallbacks()
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
           at System.Windows.Forms.Form.WndProc(Message& m)
           at Telerik.WinControls.UI.RadFormControlBase.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.RunDialog(Form form)
           at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
           at Telerik.WinControls.UI.Scheduler.Dialogs.EditAppointmentDialog.Telerik.WinControls.UI.Scheduler.Dialogs.IEditAppointmentDialog.ShowDialog()
           at Telerik.WinControls.UI.RadScheduler.ShowAppointmentEditDialog(IEvent appointment, Boolean recurringAppointment)
           at Telerik.WinControls.UI.RadScheduler.AddNewAppointmentWithDialog(IEvent appointment, DateTimeInterval interval, Boolean recurringAppointment, SchedulerResourceCollection resources)
           at Telerik.WinControls.UI.RadScheduler.AddNewAppointmentWithDialog(DateTimeInterval interval, Boolean allDay, Boolean recurringAppointment, SchedulerResourceCollection resources)
           at Telerik.WinControls.UI.SchedulerDefaultContextMenu.OnNewRecurringItemClick(Object sender, EventArgs e)
           at Telerik.WinControls.RadElement.OnClick(EventArgs e)
           at Telerik.WinControls.UI.RadButtonItem.OnClick(EventArgs e)
           at Telerik.WinControls.UI.RadMenuItem.OnClick(EventArgs e)
           at Telerik.WinControls.RadElement.DoClick(EventArgs e)
           at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
           at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
           at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
           at Telerik.WinControls.RadElement.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
           at Telerik.WinControls.RadItem.RaiseBubbleEvent(RadElement sender, RoutedEventArgs args)
           at Telerik.WinControls.RadElement.RaiseRoutedEvent(RadElement sender, RoutedEventArgs args)
           at Telerik.WinControls.RadElement.DoMouseUp(MouseEventArgs e)
           at Telerik.WinControls.ComponentInputBehavior.OnMouseUp(MouseEventArgs e)
           at Telerik.WinControls.RadControl.OnMouseUp(MouseEventArgs e)
           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
           at Telerik.WinControls.RadControl.WndProc(Message& m)
           at Telerik.WinControls.UI.RadPopupControlBase.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.Run(Form mainForm)
           at dentist.Program.Main() in C:\Users\Aref\Documents\Visual Studio 2010\Projects\dentist\dentist\Program.cs:line 21
           at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
           at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
           at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           at System.Threading.ThreadHelper.ThreadStart()
      InnerException: 
  9. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 25 Nov 2015 Link to this post

    Hello Aref,

    Thank you for writing.

    The provided information is not enough for me to replicate the issue locally. Could you please specify the exact steps/code snippet how to reproduce the problem? Feel free to open a support ticket and provide a sample project so we can investigate the precise case and assist you further. Thank you in advance. 

    I am looking forward to your reply.

    Regards,
    Dess
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  10. Aref
    Aref avatar
    18 posts
    Member since:
    Sep 2015

    Posted 05 Dec 2015 in reply to Dess Link to this post

    Dear Dess
    I resolved the problem, I was using a same label for 2 cases in my Radscheduler localization provider thanks for your time.
    Sincerely yours 
    Aref 
  11. Aref
    Aref avatar
    18 posts
    Member since:
    Sep 2015

    Posted 16 Dec 2015 Link to this post

    Dear Dess 
    Is it possible to change recurrence form font? I need to change font and I have tried to inherit recurrence form but it did not work for me. I am looking forward to hear from you.

    Sincerely yours 
    Aref

  12. Dess
    Admin
    Dess avatar
    1601 posts

    Posted 17 Dec 2015 Link to this post

    Hello Aref,

    Thank you for writing back.

    In order to change the font for the RecurrenceEditDialog, you can subscribe to the RadScheduler.RecurrenceEditDialogShowing event, iterate all the controls in the RecurrenceEditDialog and apply the desired font:
     
    private void radScheduler1_RecurrenceEditDialogShowing(object sender, RecurrenceEditDialogShowingEventArgs e)
    {
        RadForm f = e.RecurrenceEditDialog as RadForm;
        f.Font = font;
        foreach (Control c in f.Controls)
        {
              c.Font = font;
        }
    }

    Note that this is just a sample approach and it may not cover all possible cases. It would be necessary to iterate the controls recursively in case you need to apply the font to controls from all levels.  Feel free to modify it in a way which suits your requirement best.

    I hope this information helps. If you have any additional questions, please let me know.

    Regards,
    Dess
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  13. Aref
    Aref avatar
    18 posts
    Member since:
    Sep 2015

    Posted 18 Dec 2015 in reply to Dess Link to this post

    Dear Dess 
    Thanks for your post, I have already done this but some controls font's like groupbox header text and checkbox text and radiobutton text did not change. Can you please help me with this problem.

    Sincerely yours 
    Aref

  14. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 21 Dec 2015 Link to this post

    Hi Aref,

    I assume that's because they are children of container controls e.g. RadGroupBox contains other controls like buttons, check boxes, etc. To handle this case you can use the ControlHelper.GetChildControls method to get all controls recursively. 

    I would even advice to inherit from the EditRecurrenceDialog and introduce the needed modifications there. This will be cleaner solution and will allow for further extension. Here is how this class can look like:
    class MyEditRecurrenceDialog : EditRecurrenceDialog
    {
        private MyEditRecurrenceDialog()
            : base(null)
        { }
     
        public MyEditRecurrenceDialog(IEvent appointment)
            : base(appointment, null)
        {
        }
     
        public MyEditRecurrenceDialog(IEvent appointment, ISchedulerData schedulerData)
            : base(appointment, schedulerData)
        { }
     
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
     
            SetFontForControls(this);
        }
     
        private void SetFontForControls(Control parentControl)
        {
            System.Drawing.Font font = new System.Drawing.Font("Consolas", 7);
            List<Control> allControls = ControlHelper.GetChildControls<Control>(parentControl, true);
            foreach (Control c in allControls)
            {
                c.Font = font;
            }
        }
     
        protected override void ShowRecurrenceSettingsControl(IRecurrenceRuleSettingsControl settingsControl)
        {
            base.ShowRecurrenceSettingsControl(settingsControl);
     
            SetFontForControls((Control)settingsControl);
        }
    }

    The override of the ShowRecurrenceSettingsControl method is needed, as some of the controls for the recurrence are created dynamically.

    To replace the default dialog with the newly created one, you can use the RecurrenceEditDialogShowing handler, you are already familiar with:
    void radScheduler1_RecurrenceEditDialogShowing(object sender, RecurrenceEditDialogShowingEventArgs e)
    {
        e.RecurrenceEditDialog = new MyEditRecurrenceDialog(e.Appointment);
    }

    I hope that you find this information useful. 

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  15. Aref
    Aref avatar
    18 posts
    Member since:
    Sep 2015

    Posted 21 Dec 2015 in reply to Stefan Link to this post

    Dear Stefan 
    Thanks for your post. It helped a lot but is there any way to change RadGroupBox headers for this form ? They did not changed with this code. I will appreciate your help.
    Sincerely yours 
    Aref 

     

  16. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 22 Dec 2015 Link to this post

    Hi Aref,

    The headers font is changed on my end with this code. See attached image.

    Should you still experience this issue, please send over a small sample replicating it and I will look into it.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  17. Aref
    Aref avatar
    18 posts
    Member since:
    Sep 2015

    Posted 22 Dec 2015 in reply to Stefan Link to this post

    Dear Stefan
    I do not know what is wrong with me code, I attached my form.
    Thanks for your time.
    Sincerely yours 
    Aref
  18. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 23 Dec 2015 Link to this post

    Hi,

    I am not sure why you are observing this behavior. What I can offer is to also set the parentControl.Font in the SetFontForControls method:
    private void SetFontForControls(Control parentControl)
    {
        System.Drawing.Font font = new System.Drawing.Font("Consolas", 7);
        parentControl.Font = font;
        List<Control> allControls = ControlHelper.GetChildControls<Control>(parentControl, true);
        foreach (Control c in allControls)
        {
            c.Font = font;
        }
    }

    If this does not work for you, please open a support ticket where you can attach your project so we can investigate the precise behavior.

    Regards,
    Stefan
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
  19. Aref
    Aref avatar
    18 posts
    Member since:
    Sep 2015

    Posted 23 Dec 2015 in reply to Stefan Link to this post

    Dear Stefan 
    Thanks for your efforts.
    Sincerely yours 
    Aref
Back to Top
UI for WinForms is Visual Studio 2017 Ready