XamlParseException - The type 'TimePicker' was not found

Topics: Prism v4 - Silverlight 4
Sep 30, 2010 at 7:53 PM

I've had an odd problem with a TimePicker.  Another user has reported something similar in the Silverlight forum.

The error is: "XamlParseException - The type 'TimePicker' was not found."

I re-created the problem by following a series of steps:

creating a new Silverlight Application project and adding a TimePicker to the MainPage.xaml - failed to recreate

created a UserControl in the application in a Views folder, moved the TimePicker to it, added the UserControl to the MainPage.xaml- failed to recreate

Added the Prism references (V4drop8) to the project and turned MainPage.xaml into Shell.xaml, adding a Bootstrapper.cs as per the standard instructions and poiting App.xaml.cs at the bootstrapper.  I hadn't added any regions or modules- failed to recreate.

I added a module to the solution, gave the shell project a reference to it and it a ref to Prism., Created a Views folder, moved the UserControl with the TimePicker to the Views folder and changed the namespace to match the module project.  Then I created a region in the shell.xaml (using a tabcontrol) and told the module to stick the UserControl in the mainregion.  Recreated the problem.

In both my actual project and my recreating-the-problem project, the TimePicker had been dragged off the Toolbox and had the xmlns:toolkit namespace applied.  In both, I've added the xmlns:swcit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit" namespace and changed the TimePicker line to point to that.

The error now becomes (in both projects):

XamlParseException - The type 'TimePicker' was not found because 'clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit' is an unknown namespace. 

In my acual project (but not in my recreation) the latter error can be resolved by adding a Name attribute, e.g.

x:Name="Dennis"

just as with the other guy.  I haven't reported this as an issue because I can't see how it's a problem with Prism but it only manifests itself in a Prism region.

Oct 1, 2010 at 8:02 PM

Hi,

Thanks for reporting that. It would be helpful if you could send the repro sample that you mentioned. So if we found that this is an issue related to Prism, we will create a work-item for this. Additionally the community can also vote.

Fernando Antivero
http://blogs.southworks.net/fantivero

Oct 20, 2010 at 10:33 AM

Sorry about the delay - I've been out of the office.  Where would you like me to send it?

Oct 20, 2010 at 1:59 PM

Hi,

I think you could upload this to the cloud, for example using skydrive. Then you could post in this thread the URL. So all the community could contribute as well.

Thanks,

Fernando Antivero
http://blogs.southworks.net/fantivero

 

Oct 22, 2010 at 2:34 PM

Okay.  I think I've done that!  It's here: TimePickerError.zip.  I've not used SkyDrive before so we'll see how this goes.

Oct 28, 2010 at 5:32 AM

Hi.  I was wondering if you've had time to look at this?

Nov 9, 2010 at 6:37 PM

Hi,

Sorry for the delay. I reproduced this situation using your repro sample. Additionally, I think that you can find the following thread in the Silverlight Forum interesting: SL4 runtime error when parsing Generic.xaml: unknown namespace

Based on this thread, it seems to be something related to references. You can find a workaround over there.

Hope this helps.

Fernando Antivero
http://blogs.southworks.net/fantivero