Question

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?

Was it helpful?

Solution

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!

OTHER TIPS

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

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.

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top