I want to add a tooltip to the DateTimePicker Calendar that show some informations based on the date that the mouse is over. Is there a way to retrive the date under the mouse without clicking it?
A:
Are you talking about the Calendar control (AFAIK there is no DateTimePicker built into WPF as it stands).
See the section Replacing the CalendarItem Template in the article below: you can add your ToolTip there, right in the control.
It shows a calendar with phases of the moon, modified to look like a planner: very customisable!
Edit: Obviously I should say, there is source code included.
Hope that helps!
Kieren Johnstone
2010-07-15 19:48:17
It is WinForm and my problem is not to add a tooltip, it is to get the date that is under my mouse.
Wildhorn
2010-07-15 19:49:34
OK have added the winforms tag for you :) My apologies. Hopefully this will persuade you to come over to the light side of the force (WPF)!! :)
Kieren Johnstone
2010-07-15 19:55:40
If only I knew what WPF is :P
Wildhorn
2010-07-15 20:20:42
+1
A:
The native Windows DTP control is quite primitive. It doesn't support anything like HitTest() as supported by ListView and TreeView. Trying to guess where the mouse is located from the mouse position is dangerous, DTP is sensitive to format overrides in the Control Panel's Region settings. Don't try to make this work.
Hans Passant
2010-07-15 20:02:31
What would be the best way to do what I want then? I need a calandar control that allow me to get date with a mouseover :/
Wildhorn
2010-07-15 20:21:18
Well, use a calendar control then. MonthCalendar *does* have a HitTest() method.
Hans Passant
2010-07-15 20:34:18
Ah thanks. I thought that DTP was just an upgraded version of it to allow it to not take so much space.
Wildhorn
2010-07-15 20:57:45