We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Schedule - dateformat on WorkWeek

Hi,

We are using your schedule control.
Unfortunatly I have not found a way to change the format of the date in the 'header' when I am in the WorkWeek view. It is always displayed 'US' Style dd/mm/yyyy.

I thought, from reading the help, that I could change the date format in the 'Apearance.DateFormat' property.

Is this a bug on your side, or do I just use the wrong property?

Thank you

(Syncfusion.Schedule.base version 5.102.1.47)

7 Replies

AD Administrator Syncfusion Team October 1, 2007 03:47 PM UTC

Try changing the Appearance.WorkWeekHeaderFormat to see if that does what you need. It defaults to "d" which should be the local short date format. But you can set it to "yyyy.MM.dd" or whatever.

You can check the various properties out and see the impact of changing one of them by running one of our samples, and choosing the Options | Appearance | Change ... menu option.


SA Samy Abou-Shama October 1, 2007 04:49 PM UTC

Thank you very much for the reply.

Using your demo app I changed the date format and nothing changed.

Also I noticed another bug. When I change for example the CaptionBackColor to say red, I loose this setting after I change the view (day, week ...)
I have the same problem in my app. There it is even worse, I loose the MouseDown Event that I register on the scheduleControl after a change in the view.
(scheduleControl.GetScheduleHost().MouseDown += new MouseEventHandler(OnGridMouseClick);
)

Any help is apreciated :-)


AD Administrator Syncfusion Team October 1, 2007 05:31 PM UTC

The sample worked for me using 5.2. So, I installed the 5.1.0.47, version that you said you were using. I am able to change the WorkWeekHeaderFormat property and see it take effect in the schedule with this version also. I have attached a picture showing what I did. (I used the recurring events sample).

As far as subscribing to grid events, there are different grids created as you change views. So, you cannot just subscribe to a grid event once as it will be lost as you change the views (like you discovered).

So in the ScheduleControl, instead of subcribing to grid events to modifiy grid behavior, you will need to derive the ScheduleControl class and override CreateScheduleGrid. There you can create an instance of a derived ScheduleGrid. In the derived grid, you can then override methods like OnMouseDown to affect the behavior of the grid. (This would be instead of trying to subscribe to a grid.MouseDown event.) But this will take some coding.

Why are you trying to catch the MouseDown on the embedded grid? You might look around to see if there is an event directly on the ScheduleControl that you might be able to use.

schedule.zip


SA Samy Abou-Shama October 1, 2007 06:17 PM UTC

I need the event to enable/disable context menu items, depending on the item selected.
If I use other events, they I did not manage to get the selection under the 'right mouse click' in time :-( i.e. if I first select an item (with left click) it worked fine in other events, but if I only 'left click' directly into a new selection, I sometimes did not get the 'new Selection' before the actual context menu was drawn!
(hope you understand - that's not easy to explain!)

As for the sample - I will test it first thing tomorrow....


AD Administrator Syncfusion Team October 1, 2007 06:36 PM UTC

Here is a link to a minimal sample that is just the schedule and a button that togglles the WorkWeekHeaderFormat date format.


SampleSchedule.zip


SA Samy Abou-Shama October 4, 2007 10:32 AM UTC

Thank you very much, that really helped!

Only one more thing :-)
When the ViewType changes, I loose one of my Apperance settings.
I set the following:
scheduleControl.Appearance.PrimeTimeCellColor = Color.White;

Am I doing something wrong? can I override something on my derived ScheduleControl?

Thank you very much - your help is really apreciated - had I posted my problems at an earlier stage, then I would have had more sleep in the last couple of weeks ;)


AD Administrator Syncfusion Team October 10, 2007 02:29 PM UTC

Losing the Appearance.PrimeTimeColor settings is a defect which we will have to correct in our code base. The problem is that as the grids is being created (when the ViewType is changed), the VisualStyles settings are being re-applied to the new grid, and these settings are stepping on some of the color properties.

If you are deriving the ScheduleGrid, you can make the color stick by setting the property in the constructor.

public class MyScheduleGrid : ScheduleGrid
{
public MyScheduleGrid()
: base()
{

}

public MyScheduleGrid(NavigationCalendar calendar, ScheduleControl schedule, DateTime theDate)
:
base(calendar, schedule, theDate)
{
schedule.Appearance.PrimeTimeCellColor = Color.White;
}
}

Loader.
Live Chat Icon For mobile
Up arrow icon