Wednesday, March 16, 2011

Where is the Silverlight Calendar Control?

Just playing around with the now released Silverlight 2.0. I'm trying to put a simple Calendar in a control. However the project doesn't seem to know what I'm talking about:-

<UserControl x:Class="MyFirstSL2.Test"
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
>
  <Grid Background="#FF5C7590">
    <Calendar />
  </Grid>
</UserControl>

Visual Studio 2008 just puts blue line under the Calendar saying the type Calendar not found. Do I need to add an assembly? Which one? Do I need to add another namespace to the Xaml?

From stackoverflow
  • I'm pretty sure there's no calendar control in Silverlight that is analogous to the ASP.Net control or the windows forms control. I'm pretty sure there's not a pre-packaged control like that for WPF, either.

    MojoFilter : Haha. Ok, so I guess there is one :)
    Rob Prouse : Microsoft has released one for WPF too. Check CodePlex.
  • The calendar control is an SDK control in the assembly System.Windows.Controls namespace -- look at %program files%\Microsoft SDKs\Silverlight\v2.0\Libraries\Client add a namespace to your xaml (after you add a reference):

    xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
    

    Then to use:

    <basics:Calendar />
    

    Hope this helps!

    AnthonyWJones : Spot on. Thanks.
  • Anyone succeeded in embedding a XAML calendar control?

  • add a reference to

    C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Libraries\Client

    system.windows.controls.dll

    Use Expressions Blend or VS2008 SP1 to add the control to the UI

  • Instead of trying to figure out how the toolkit allows for an embeded calendar control I created a custom control here http://slcalendarcontrol.codeplex.com/ check it out.

0 comments:

Post a Comment