Monday, March 12, 2012

A month view calendar for WP7

We know that wp7 is a bit young but it has a good potential.
We also know that its youth means, for developers, poor os-controls, poor API etc...

Last week I had to demonstrate that WP7 is comparable to iOS and Android. 
I had to realize a sort of "accounting app" already done in iOS and Android.

I had no significant problems while working except for some limits of SDK.
SDK doesn't provide a datetime picker, a combo box or list picker not even a calendar.

I found on the web a Silverlight for Windows Phone Toolkit that brings some controls I've just mentioned.

No track of a calendar :(

I found only 1 calendar for wp7 on web but it didn't like me.... So..
I decided to make my own :)
It's a calendar with a month view. Not too complete, I needed only this view just for showing events and having a complete point of view of the month.

Graphically is very simple, I tryed to stay in Metro UI style even if these are the first times I approach to WPF and WP7.
Programmatically I honestly say that I could do a better work.

It's a UserControl called LCalendar you can include in your project in this way:

 <cc:LCalendar x:Name="calendar" 
                 ButtonBackground="{StaticResource PurpleBrush}"  
                 HolidayBrush="{StaticResource PurpleBrush}"
                 EventsBackgroundBrush="{StaticResource PurpleBrush}"
                 ButtonBorderBrush="Black"  />

As you can see there are some property you can use for customize UI.
OnDayClicked (a.e.) is the event when you press on a day.
Anyway the code I give you is open so you can do what you want with this UC :)

Summarizing the features:

  • Month calendar view in METRO UI.
  • Days/Months name are loaded from DateTime class so changes with the current Culture.
  • Can customize images and colors.
  • Can load more events for a day. When a day has a event, the calendar will mark the day with your EventsBrush color.
  • At the click of the day you can handle an event that returns the day and the associated events.

So here it is the source and a screenshot. Hope you like it. :)

Don't you scare if you find some comments in italian.


  1. This is what I'm looking for... Can you answer some of my questions please? Thanks

    (messenger request pending)

  2. I can't see your messenger request...
    If you want to ask me here, you are welcome