问题
This is really a wanted feature, AutoCompleteBox (not AutoCompleteComboBox apparently). However, visual studio 2012 cannot find the AutoCompleteBox control. But I have not tried in earlier version of vs, so it may not be a version matter.
I installed wpf toolkit, added those extensions to my WPF project:
- WPF Toolkit
- WPF Toolkit Design
- WPF Toolkit Input Design
- WPF Toolkit Input Visual Studio Design
- WPF Toolkit Layout
- WPF Toolkit Layout Visual Studio Design
- WPF Toolkit Visual Studio Design.
Looks almost like virii to me. Every permutation of words are used... Well well in my WPF project, I added
xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
to a window and tried to also add a auto complete box like this:
<toolkit:AutoCompleteBox />
but AutoCompleteBox does not seem to exist, the first component that is listed when I have typed
<toolkit:
is ButtonBaseBehavior.
回答1:
Not all the toolkit controls are included in the "main" namepace.
Let me explain it how are the toolkit dlls are built up:
You can also install the WPF toolkit through NuGet:
PM> Install-Package WPFToolkit
It will add three dlls to your project:
WPFToolkit.dll this contains the core/stable controls of toolkit which can be found in the
xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"System.Windows.Controls.Input.Toolkit.dll this dll contains the preview controls like
AutoCompleteBoxandRatingSystem.Windows.Controls.Layout.Toolkit.dll this dll contains the preview layout controls like the
Accordion
The preview controlls are not included in the main xmls namespace so you need to use a the namespace form the corresponding preview dll:
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
<controls:AutoCompleteBox />
回答2:
Add a reference to (Included in WPFToolkit):
System.Windows.Controls.Input.Toolkit.dll
and then in your xaml at the top:
xmlns:System_Windows_Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"
and for using it anywhere in your code just like this:
<System_Windows_Controls:AutoCompleteBox />
来源:https://stackoverflow.com/questions/12033404/autocompletebox-not-found-in-wpf-toolkit-using-visual-studio-2012