views:

423

answers:

3

I am trying to add a DatePicker control to my page programmatically, but intellisense is not picking up the DatePicker type as I would expect.

MSDN shows this control as being part of System.Windows.Controls

I have referenced this assembly in my project, and in my usings statement, but still VS cannot recognise the DatePicker type.

I would expect this to work:

using System.Windows.Controls;

    namespace MyNamespace
    {
        public partial class MyClass : UserControl
        {
            ...


            public void MyMethod
            {
                DatePicker datePicker = new DatePicker();

            }

            ...
        }
    }

Compiler Error: The type or namespace name 'DatePicker' could not be found (are you missing a using directive or an assembly reference?)

Any ideas?

Thanks, Mark

A: 

I believe the Datepicker is not included in the silverlight runtime, (I could be worng).

There is an opensource project at codeplex that has a control that provides this functionallity.

Nate Bross
Thanks for taking the time to answer. This is the control I am taking about, it can be seen on their wiki http://silverlight.codeplex.com/Wiki/View.aspx?title=Silverlight%20Toolkit%20Overview%20Part%201 derives from the System.Windows.Controls namespace as defined above.
Mark Cooper
A: 

I removed and readded the reference to System.Windows.Controls and this worked. The references must have gotten screwed up along the way - not the first time this has happened, and I'm sure it won't be the last :-)

Mark Cooper
A: 

Please see link below

http://asimsajjad.blogspot.com/2010/03/datepicker-control-silverlight-30.html

hope that will help.

Asim Sajjad