This is a migrated thread and some comments may be shown as answers.

Customization of the MonthView with inherited Appointment Classes

2 Answers 66 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Guga
Top achievements
Rank 1
Guga asked on 02 May 2012, 02:14 PM
Hi guys,

I am currently evaluating the Scheduler control for one of my company's projects.

We are using Visual Studio 2010, targeting .NET framework 2.0 and x86 CPU. We are also using the latest version of the controls available atm.

I will start by congratulating Telerik on the whole package of controls and tools and hopefully we will be able to get this sorted out so we can buy the complete package and use it for our next version of the software.

An overview of what we are trying to achieve:

We have two types of events (I will give them generic names for privacy reasons):

-Base Event (Recurring type)
-Completion Event

The base events are created first and have a start date, end date and a frequency.
The completion events are created by the user to target a specific instance of one or more base events.

ex:
 I create "Base Event 1" and "Base Event 2" both starting on 1/1/2001. Base 1 is daily, Base 2 is weekly.

At a different time I create a Completion Event that targets both the instance of Base Event 1 that occurs on the 8/1/2001 and the instance of Base Event 2 that occurs on the same date.

We need to display this information to the user on the Scheduler MonthView and TimeLineView in a way that allows the uses to have a global view of the all the Base Events with a different graphical representation to the Completion Events.

Also we need to have a visual link between each Completion Event and each of its Base Events.

Finally we need to be able to select a date and create a Completion Event, with the ability to select the target Base Events.


With this general idea I tried different approaches trying to adapt my solution to the scheduler architecture:

1 - Using the Base Event as resources:

This would allow me to use the Group By Resources and have a deferentiated view of each Base Event's Completion Events.

Limitations: 

I need to be able to show all of the Base events on the same calendar along with all the Completion Events
I need to have single instances of the Main events on specific dates, so having them as resources is a big limitation.

Question:

Is it possible to use the Group By function with anything else other that the resources? If so, how?

2 - Create 2 derived classes of the Appointment, 1 for each kind of event, and display them differently, catching the AppointmentFormatting event:

This was by far the closest I got to a solution...

Limitations:

The month view appears to only be able to support 1 appointment per line with a default height and a default visual style.

Questions:

-Can I change the style (template?) of the Appointment base on its type? Lets say I wanted to draw the BaseAppointment as a Square and the CompletionAppointment as a Circle (Or something else that would differentiate them clearly?

-Can I change the style of the MonthCellElements so they can look divided into two? (kind of 'group by' inside each CellElement). I also tried adding controls to the Children collection, but they work on all views except the MonthView. On the month view the added controls only appear on the HeaderCells... (Bug??? I can send Screen Shots of this if you would like...) 

-I can obviously add a collection of BaseAppointments to my CompletionAppointment class (which I did), but how can I display this relation to the user on the MonthView (or the TimeLineView)?


Sorry for the lenghty post but I was trying to be as clear as possible.

I have attached a screenshot of one of my tests, so you can have an idea of what I am trying to achieve. Each of the buttons inside the appointments represent a link to the respective base appointment with matching colors.

Regards,

Hugo

2 Answers, 1 is accepted

Sort by
0
Ivan Todorov
Telerik team
answered on 07 May 2012, 11:26 AM
Hello Hugo,

Thank you for the detailed explanation of your case.

In regards to your question corresponding to your first approach, no, currently it is not possible to group by any other criteria than Resource. In this case you can change the approach a bit by creating a derived Resource type that holds a reference to your base appointments and add some logic to create a resource for each base appointment you add. This way you will also have the two types of appointments and they will be added to RadScheduler as actual appointments, but you will also have a resource for each base appointment you add. Shortly said, you can achieve some kind of "binding" between the base appointments and the resources. With this approach I think you can overcome the limitations you mentioned.

As to the second approach, the only way to change the style of the appointments is via the AppointmentFormatting event. Also, there are some style properties that are internally controlled by RadScheduler (shape, border, background) and there is a specific way to change each of them. RadScheduler also recycles its elements regularly, so adding children to the approach with adding elements to RadScheduler's cells might lead to additional complications. Nevertheless, this can be achieved by handling the CellFormatting event and checking the Children collection of the current cell:
void radScheduler1_CellFormatting(object sender, SchedulerCellEventArgs e)
{
    if(e.CellElement.GetChildrenByType(typeof(MyElementType)).Count == 0)
    {
        e.CellElement.Children.Add(new MyElementType());
    }
}

As to displaying the relation between appointments, I am not sure what appearance you are after, but you can use the Paint event of RadScheduler to draw lines between related appointments. Please refer to the attachment for more information on how to achieve this.

I hope I was able to answer your questions. Do not hesitate to write back if you need further assistance or if you have any additional questions.

All the best,
Ivan Todorov
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
0
Guga
Top achievements
Rank 1
answered on 08 May 2012, 12:20 AM
Hi Ivan,

Thank you for you reply and the thought you have put into it.

For now I have gone with the first approach of creating my base entities as Resources(so I can group by them) and also adding them as recurring appointments with the same Resource.

I then add the Conpletion Events for the respective Resources (i keep track of the relation between the two on my database anyway...)

At least for now that will have to do since I have a deadline for a demo this week.

I am planning on coming back to it next week and try to customize it further (maybe even using the wpf vesrsion of the control, that seems to open up more customization possibilities.

Also thank you for the example on how to create the lines between the elements.

I will let you know when I need more help.


Regards,

Hugo
Tags
Scheduler and Reminder
Asked by
Guga
Top achievements
Rank 1
Answers by
Ivan Todorov
Telerik team
Guga
Top achievements
Rank 1
Share this question
or