views:

2873

answers:

5

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?

A: 

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 :)
MojoFilter
Microsoft has released one for WPF too. Check CodePlex.
Rob Prouse
+13  A: 

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!

Tim Heuer
Spot on. Thanks.
AnthonyWJones
A: 

Anyone succeeded in embedding a XAML calendar control?

+1  A: 

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

A: 

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.