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

偶尔善良 提交于 2021-02-07 08:33:09

问题


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

It's here though?

enter image description here


回答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.




回答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




回答3:


I had the same issue though installing the SilverlightToolkip WP with Nuget did the trick.

Install-Package SilverlightToolkitWP



来源:https://stackoverflow.com/questions/9655345/the-referenced-component-microsoft-phone-controls-toolkit-could-not-be-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!