MonthCalendar in XAML using WindowsFormsHost

hi,
For all those disappointed in the dropped MonthCalendar and needing it like
me,
here is a workaround, use the WinForm one instead !, we ARE just dealing
with classes you know !

Reference WindowsFormsIntegration.dll
i used C:\Program Files\Reference Assemblies\Microsoft\WPF\v3.0

<!-- in XAML create a Canvas as a container -->
<Page....
<StackPanel...
<Canvas x:Name="canvasContainer"></Canvas>
</StackPanel>
</Page>


//in Code
using System.Windows.Forms.Integration;

System.Windows.Forms.MonthCalendar monthCalendarStart = new
System.Windows.Forms.MonthCalendar();

WindowsFormsHost oWindowsFormsHost = new WindowsFormsHost();
oWindowsFormsHost.Height = 100;
oWindowsFormsHost.Width = 300;
oWindowsFormsHost.Children.Add(monthCalendarStart);
oWindowsFormsHost.SetValue(Canvas.TopProperty, 5.0);
oWindowsFormsHost.SetValue(Canvas.LeftProperty, 5.0);
this.canvasContainer.Children.Add(oWindowsFormsHost);

DateTime oDateTime = monthCalendarStart.SelectionStart.Date; // and get the
value as normal
--------------------------
If you are using this stuff I'd like to chat to you, basically any Vista
Technologies actually, for some real projects, please see website for
contacts.

with much thanks to Mike Henderlight and his excellent and amusing blog
http://blogs.msdn.com/mhendersblog/



cheers,

craig kelly-soens - Windows Vista WinFx XAML .Net Technical Evangelist
http://www.XpectWorld.com - customised "super-easy to use" Windows Vista
based .Net software & consultancy and the Xtensions Customer Xperience
Manager database