使用 Visual Studio 2012 在 wpf 工具包中找不到 AutoCompleteBox

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12033404/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 05:01:56  来源:igfitidea点击:

AutoCompleteBox not found in wpf toolkit using visual studio 2012

wpfwpftoolkit

提问by Anders Lindén

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.

这确实是一个需要的功能,AutoCompleteBox(显然不是 AutoCompleteComboBox)。但是,visual studio 2012 找不到 AutoCompleteBox 控件。但是我没有在vs的早期版本中尝试过,所以可能不是版本问题。

I installed wpf toolkit, added those extensions to my WPF project:

我安装了 wpf 工具包,将这些扩展添加到我的 WPF 项目中:

  • 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.
  • WPF工具包
  • WPF 工具包设计
  • WPF 工具包输入设计
  • WPF 工具包输入 Visual Studio 设计
  • WPF 工具包布局
  • WPF 工具包布局 Visual Studio 设计
  • WPF 工具包 Visual Studio 设计。

Looks almost like virii to me. Every permutation of words are used... Well well in my WPF project, I added

对我来说看起来几乎像 virii。使用每个单词排列......在我的 WPF 项目中很好,我补充说

xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"

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

但是 AutoCompleteBox 似乎不存在,这是我键入时列出的第一个组件

<toolkit:

is ButtonBaseBehavior.

是 ButtonBaseBehavior。

回答by nemesv

Not all the toolkit controls are included in the "main" namepace.

并非所有工具包控件都包含在“主”命名空间中。

Let me explain it how are the toolkit dlls are built up:

让我解释一下工具包 dll 是如何构建的:

You can also install the WPF toolkit through NuGet:

您还可以通过 NuGet 安装 WPF 工具包:

PM> Install-Package WPFToolkit

It will add three dlls to your project:

它将向您的项目添加三个 dll:

  • WPFToolkit.dllthis 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.dllthis dll contains the previewcontrols like AutoCompleteBoxand Rating

  • System.Windows.Controls.Layout.Toolkit.dllthis dll contains the previewlayout controls like the Accordion

  • WPFToolkit.dll包含工具包的核心/稳定控件,可以在xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"

  • System.Windows.Controls.Input.Toolkit.dll这个DLL包含预览像控制AutoCompleteBoxRating

  • System.Windows.Controls.Layout.Toolkit.dll这个 dll 包含预览布局控件,如Accordion

The previewcontrolls are not included in the main xmls namespace so you need to use a the namespace form the corresponding preview dll:

预览controlls不包括在主要个XML命名空间,所以你需要使用一个命名空间的形式相应的预览DLL:

xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"

<controls:AutoCompleteBox />

回答by Hossein Amini

Add a reference to (Included in WPFToolkit): System.Windows.Controls.Input.Toolkit.dlland then in your xaml at the top:

添加对(包含在 WPFToolkit 中)的引用: System.Windows.Controls.Input.Toolkit.dll然后在顶部的 xaml 中:

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 />