C# 命名空间中不存在来自 WPFToolkit 的控件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11298435/
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
Control from WPFToolkit doesn't exist in namespace
提问by cadi2108
I added to references WPFToolkit.dll and I added do my .xaml file following line:
我添加到引用 WPFToolkit.dll 并添加以下行执行我的 .xaml 文件:
xmlns:toolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WpfToolkit"
and before following line:
在以下行之前:
xmlns:toolkit="http://schemas.microsoft.com/wpf/2008/toolkit"
In both cases in line
在这两种情况下
<toolkit:NumericUpDown Value="10" Increment="1" Maximum="10" Minimum="0" />
I have error:
我有错误:
Error 1 The tag 'NumericUpDown' does not exist in XML namespace 'http://schemas.microsoft.com/wpf/2008/toolkit'. Line 20 Position 18. C:\Users\Diament\Documents\Visual Studio 2008\Projects\MyBasicFlyffKeystroke\MyBasicFlyffKeystroke\Window.xaml 20 18 MyBasicFlyffKeystroke
错误 1 XML 命名空间“http://schemas.microsoft.com/wpf/2008/toolkit”中不存在标记“NumericUpDown”。第 20 行位置 18. C:\Users\Diament\Documents\Visual Studio 2008\Projects\MyBasicFlyffKeystroke\MyBasicFlyffKeystroke\Window.xaml 20 18 MyBasicFlyffKeystroke
Where is the problem? :(
问题出在哪儿?:(
回答by Tigran
Note: Consider the Extended WPF Toolkit - Numeric Up Down, is obsolete. And they strongly suggest to use any of "specialized" versions. This, by the way, shouldn'tgenerate an Error, but Warning.
注意:请考虑扩展 WPF 工具包 - Numeric Up Down已过时。他们强烈建议使用任何“专业”版本。顺便说一下,这不应该生成Error,而是Warning。
What about not finding the assembly, check your project's and Wpf Toolkitversions compatibility.
找不到程序集怎么办,请检查您的项目和Wpf Toolkit版本兼容性。
回答by cppanda
try
尝试
xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
回答by NoNameStackExchange
NumericUpDown is not part of the basic WPF Toolkitbut part of the Extended WPF Toolkit
NumericUpDown 不是基本 WPF 工具包的一部分,而是扩展 WPF 工具包的一部分
Use the IntegerUpDown (or any of the provided derived classes) and be sure to use the appropriate DLL in your application. Here is an example using the IntegerUpDown when the Extended WPF Toolkit DLL (Xceed.Wpf.Toolkit.Dll) is referenced by your project:
使用 IntegerUpDown(或任何提供的派生类)并确保在您的应用程序中使用适当的 DLL。这是当您的项目引用扩展 WPF 工具包 DLL ( Xceed.Wpf.Toolkit.Dll)时使用 IntegerUpDown 的示例:
<Window x:Class="WpfApplication4.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:toolkit="http://schemas.xceed.com/wpf/xaml/toolkit"
Title="Window1" Height="300" Width="300">
<Grid>
<toolkit:IntegerUpDown Value="10" Increment="1" Minimum="0" Maximum="10" />
</Grid>
</Window>
回答by andrew-g-za
I had the exact same problem.
我有同样的问题。
If I skippedthe unblock step and simply unzipped, the xaml preview window would not load and VS would keep giving me the 'IntegerUpDown component does not exist in the namespace http://schemas.xceed.com/wpf/xaml/toolkit' error, even though auto-complete would happily list all the components in that namespace.
如果我跳过取消阻止步骤并简单地解压缩,则 xaml 预览窗口将不会加载,并且 VS 将继续向我提供“名称空间http://schemas.xceed.com/wpf/xaml/toolkit中不存在 IntegerUpDown 组件”错误,即使自动完成很乐意列出该命名空间中的所有组件。
However if I unblockthe zip file first, then extract, then reference the dll in VS, it all works correctly.
但是,如果我先取消阻止zip 文件,然后解压缩,然后在 VS 中引用 dll,则一切正常。
TL;DR:follow the installation instructionsexactly, particularly unblockingthe zip file first.
TL; DR:按照安装说明完全相同,尤其是疏导,首先把ZIP文件。
回答by Noctis
I've followed @Andrew suggestion (download, unblock, extract, add), but still had the same issue.
我遵循了@Andrew 的建议(下载、解锁、提取、添加),但仍然有同样的问题。
Instead, the install through the NUGET (follow the instructions on their page here) made it work without the need to do the manual steps.
相反,通过 NUGET 安装(按照此处页面上的说明进行操作)使其工作而无需执行手动步骤。
Go go nuget ...
去吧 nuget ...
回答by Rusty Nail
http://wpftoolkit.codeplex.com/documentation
http://wpftoolkit.codeplex.com/documentation
Installation and Usage Instructions
安装使用说明
Please note: The Extended WPF Toolkit is dependent on .NET Framework 4.0. You must install .NET Framework 4.0 in order to use any features in the Toolkit.
请注意:扩展 WPF 工具包依赖于 .NET Framework 4.0。您必须安装 .NET Framework 4.0 才能使用 Toolkit 中的任何功能。
Instructions for using the Extended WPF Toolkit binaries:
使用扩展 WPF 工具包二进制文件的说明:
1.Install .NET Framework 4.0.
2.Download the ExtendedWPFToolkit_Binaries
3.Unblock the ZIP file. 1.Right-click ExtendedWPFToolkit_Binaries.zip -> Properties -> Unblock
4.Unzip the ExtendedWPFToolkit_Binaries.zip
5.Reference the binaries in your project:
1.Reference WPFToolkit.Extended.dll in your project (Xceed.Wpf.DataGrid.dll for the datagrid control)
2.Add a using statement ("using Xceed.Wpf.Toolkit;" for most of the controls, "using Xceed.Wpf.DataGrid;" for the datagrid control) to the top of .cs files
3.Add a new xmlns (xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" for most of the controls, xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid" for the datagrid control) to the top of XAML files
4.Remember to use the namespace prefix (in the above example, <xctk: ...> or <xcdg: ...>) in the body of your XAML
Installation using NuGet
使用 NuGet 安装
1.Install NuGet (can be downloaded for this link: https://visualstudiogallery.msdn.microsoft.com/27077b70-9dad-4c64-adcf-c7cf6bc9970c).
2.Open your Visual Studio.
3.Open your solution/project.
4.Open Tools menu, select Library Package Manager and select Package Manager Console
5.Run the following command Install-Package Extended.Wpf.Toolkit
1.Add a using statement ("using Xceed.Wpf.Toolkit;" for most of the controls, "using Xceed.Wpf.DataGrid;" for the datagrid control) to the top of .cs files
2.Add a new xmlns (xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" for most of the controls, xmlns:xcdg="http://schemas.xceed.com/wpf/xaml/datagrid" for the datagrid control) to the top of XAML files
3.Remember to use the namespace prefix (in the above example, <xctk: ...> or <xcdg: ...>) in the body of your XAML
回答by Ahmad
I have Found the same Error. You have to uninstallcurrent install toolkit and reinstall toolkitit will solve the error.Its not a proper solution but you are able to continue you work.
我发现了同样的错误。您必须卸载当前的安装工具包并重新安装工具包,它会解决错误。这不是一个正确的解决方案,但您可以继续工作。

