Page Index Toggle Pages: 1 Send TopicPrint
Hot Topic (More than 10 Replies) Holidays in Resource View (Read 6494 times)
DoctorsDad
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: May 19th, 2011
Holidays in Resource View
May 27th, 2011 at 11:19am
Print Post  
I see that Planner.Net defines a Holiday class but I can find no information on how to use it. I just want to block out parts of my Resource view on Contacts. Do I need to set it all up myself?
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Holidays in Resource View
Reply #1 - May 27th, 2011 at 12:07pm
Print Post  
The HolidayProviders classes can supply information about some of the predefined holidays in specific cultures but if you want to change the visualization or the behavior of the Calendar control based on this information you need to do it manually. You can check the Holidays sample to see how you can modify the appearance of selected dates. In addition, in order to prevent the users from creating items in those days, you can handle the ItemModifying and ItemCreating events and perform the required validations.

Let me know if this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
DoctorsDad
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: May 19th, 2011
Re: Holidays in Resource View
Reply #2 - May 31st, 2011 at 3:23pm
Print Post  
Thanks Meppy.

I have that working OK in the Resource View but I can't get the same trick to work in the MonthRange View. I'm using that to display an entire year (3 rows of 4 months) and as well as showing holidays, I want to display resource utilisation by shading the background colour of each day. Setting CustomDraw to MonthView block colours the entire month and cellcontents must get overwritten when the day numbers are drawn.

What I'd really like is a traditional YearPlanner chart. Is there one available?

Regards,
DoctorsDad
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Holidays in Resource View
Reply #3 - Jun 1st, 2011 at 6:59am
Print Post  
In order to change the appearance of individual days in a MonthRange view you can use custom drawing (but set Calendar.CustomDraw to CellHeader | CellContents). An easier approach would be to define custom style for a day or a range of days. The following sample code illustrates how:

Code
Select All
DateStyle dateStyle = new DateStyle();
dateStyle.From = new System.DateTime(2011, 6, 1);
dateStyle.To = new System.DateTime(2011, 6, 1);
dateStyle.Style = new Style();
dateStyle.Style.Brush = new MindFusion.Drawing.SolidBrush(Color.Red);
calendar1.DayStyles.Add(dateStyle); 


The above code will color the cell corresponding to June 1st in red.

Let me know if this helps.

Regards
Meppy
  
Back to top
 
IP Logged
 
DoctorsDad
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: May 19th, 2011
Re: Holidays in Resource View
Reply #4 - Jun 1st, 2011 at 8:59am
Print Post  
Hi Meppy,

The daystyle works ok for a handful of days but I want to create a slightly different background colour for all 365 days in the year and this method would be hard work.

I used CustomDraw=CellContents without success. I suspect my background colour was being overridden by the style.

BTW I really appreciate the fast response to queries!

DoctorsDad
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Holidays in Resource View
Reply #5 - Jun 1st, 2011 at 9:44am
Print Post  
Can you post here the code you are using for custom drawing or send your application or the portion of it representing the custom drawing to meppy@mindfusion.eu?

Regards,
Meppy
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Holidays in Resource View
Reply #6 - Jun 3rd, 2011 at 6:13am
Print Post  
Hi,

I checked the sample you sent me. The problem turned out to be that in the Win2003 theme cells don't have content by default, that is, the entire cell is occupied by the cell's header. Therefore, in order to custom-draw the cells, you need to specify CellHeader for the Calendar.CustomDraw property (instead of CellContents).

Let me know if this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
DoctorsDad
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: May 19th, 2011
Re: Holidays in Resource View
Reply #7 - Jun 3rd, 2011 at 7:45am
Print Post  
Yep that does it!

Thanks again.

Is there any alternative way of displaying an entire year? I wondered if your Gannt chart control provided a more typical year planner view?

Regards,
DoctorsDad
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Holidays in Resource View
Reply #8 - Jun 3rd, 2011 at 8:32am
Print Post  
The Gantt control is quite capable of displaying very large time spans and can interactively zoom-in and out but is currently available only for WPF. As an alternative you can use the Resource view - it can display one or more years simultaneously.

Regards,
Meppy
  
Back to top
 
IP Logged
 
DoctorsDad
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 20
Joined: May 19th, 2011
Re: Holidays in Resource View
Reply #9 - Jun 3rd, 2011 at 8:45am
Print Post  
I'm sorry but I can't see how the Resource view can give me a full year to view and still resolve individual days.

  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Holidays in Resource View
Reply #10 - Jun 3rd, 2011 at 8:59am
Print Post  
It can't, unless you have a very wide monitor. Smiley Or if you don't have the requirement to view all the days in the year at once - they simply cannot fit in a single row on the screen. In case you want all of the days in a year to be visible at once, you have to resort to the MonthRange view.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint