tags:

views:

55

answers:

1

As a personal project, I'm putting together a C# WPF calendar.

I'm stuck on coding the calendar screen - specifically, the 5x7 grid of days.

I've first tried to code it using elements like Panels, Labels, and Buttons. I've decided that was too cumbersome.

I've then decided to use GDI to draw the calendar myself. I now have a wonderful layout - but I'm not sure how to handle interactive regions of the calendar. (Say, Previous/Next month, clicking on any particular day...)

After rendering the calendar screen, should I be creating button objects for all those tasks, and assigning onClick handlers to them?

Or is there an alternative solution?

Thanks in advance.

-Vladislav

+1  A: 

You should not place controls on your hand-drawn panel; that's a recipe for trouble.

Instead, you should store the bounds of the buttons as Rectangles, and track them yourself in mouse events.

However, it would be better to implement everything in WPF, using a Grid and some Buttons.

SLaks
Thank you very much - I'll try to implement the app wholly in WPF.
Vladislav