The referenced component 'Microsoft.Phone.Controls.Toolkit' could not be found?

15,446

Solution 1

It looks like the problem is that you're trying to reference a copy of the Microsoft.Phone.Controls.Toolkit .dll in your Ref folder, but Visual Studio is probably looking for somewhere else.

If you open Visual Studio and expand the References folder in the Solution Explorer, you'll probably see that Microsoft.Phone.Controls.Toolkit is listed but marked with a yellow warning icon.

Try right clicking that and clicking Remove. Then right click on References, browse to file in your Ref folder, and re-add it.

Update: The ListPicker is a control in the Silverlight Toolkit for Windows Phone, which is an add in set of controls published by Microsoft. That's the reference you just added back into your app.

When you add a control to the page, you need to add a reference to the .dll to the XAML page and map it to a prefix that will tell Visual Studio where to find the control:

<phone:PhoneApplicationPage x:Class="MyApp.MainPage"
                            xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                            xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
                            xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
                            xmlns:controls="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls"
                            xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit">

Note the toolkit prefix.

Now you can add a control like this:

<toolkit:ListPicker></toolkit:ListPicker>

If those items are set up correctly, you might also need to check if the .dll was "blocked" when you downloaded it. Browse to the .dll in Explorer, then right click and look at the bottom for a button called Unblock. If it's there, click it.

The references in the XAML can be tricky to set up. There's a sample app available for the toolkit that can be helpful.

Solution 2

You can install Nuget and use it to install the Toolkit. Add the Toolkit to your project by following the steps below;

  • In Visual Studio go to the Tools menu
  • Select Library Package Manager
  • Open the Package Manager Console
  • Type PM> install-package WPToolkit

This will install and add the toolkit to your project.

Find the full article here

Share:
15,446

Related videos on Youtube

AlexDuncan
Author by

AlexDuncan

Updated on June 05, 2022

Comments

  • AlexDuncan
    AlexDuncan almost 2 years

    The referenced component 'Microsoft.Phone.Controls.Toolkit' could not be found?

    It's here though?

    enter image description here

  • AlexDuncan
    AlexDuncan about 12 years
    Josh, that worked a treat, but now i'm getting a new error "The type or namespace name 'ListPicker' does not exist in the namespace 'Microsoft.Phone.Controls' (are you missing an assembly reference)"
  • Josh Earl
    Josh Earl about 12 years
    I updated my original answer, if you're still having issues. :)