如何使扩展 WPF 工具包 ColorPicker 工作?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13541361/
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 06:21:17  来源:igfitidea点击:

How do I make the Extended WPF Toolkit ColorPicker work?

c#wpfwpftoolkitcolor-picker

提问by CodeMonkey

I would like to be able to use this color picker in my application:

我希望能够在我的应用程序中使用这个颜色选择器:

http://wpftoolkit.codeplex.com/wikipage?title=ColorPicker&referringTitle=Documentation

http://wpftoolkit.codeplex.com/wikipage?title=ColorPicker&referringTitle=文档

I'm using Visual Studio 2010 Ultimate with .NET 4 installed. I'm coding in C# and WPF (XAML).

我正在使用安装了 .NET 4 的 Visual Studio 2010 Ultimate。我正在使用 C# 和 WPF (XAML) 进行编码。

What I've done so far:

到目前为止我所做的:

  1. Downloaded and unzipped WPFToolkit.Extended.dll
  2. Added a reference to it in Visual Studio (can I verify this somehow?)
  3. Added this line to MainWindow.xaml.cs: using Xceed.Wpf.Toolkit;
  4. Added the bold line to MainWindow.xaml:

    < Window x:Class="TDDD49Task2.ColorWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit/"[...]>

  5. Tried to use < xctk:ColorPicker> in MainWindow.xaml (Error message: "The type 'xctk:ColorPicker' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built.").

  6. Googled for a solution, tutorial or example without much success.

  1. 下载并解压 WPFToolkit.Extended.dll
  2. 在 Visual Studio 中添加了对它的引用(我可以以某种方式验证这一点吗?)
  3. 将此行添加到 MainWindow.xaml.cs: using Xceed.Wpf.Toolkit;
  4. 将粗线添加到 MainWindow.xaml:

    < 窗口 x:Class="TDDD49Task2.ColorWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006 /xaml" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit/"[...]>

  5. 尝试在 MainWindow.xaml 中使用 < xctk:ColorPicker>(错误消息:“未找到类型 'xctk:ColorPicker'。确认您没有丢失程序集引用并且所有引用的程序集都已构建。”)。

  6. 谷歌搜索解决方案、教程或示例,但没有取得多大成功。

Please explain how the Extended WPF Toolkit is used or point me in the right direction.

请解释如何使用扩展 WPF 工具包或为我指明正确的方向。

回答by kmatyaszek

This error occur also when you don't unblock the assembly.

当您不取消阻止程序集时也会发生此错误。

Below is short instruction to this:

以下是对此的简短说明:

  1. Right click on the "WPFToolkit.Extended.dll".
  2. Click Unblock in the Security section.
  1. 右键单击“WPFToolkit.Extended.dll”。
  2. 单击“安全”部分中的“取消阻止”。

enter image description here

在此处输入图片说明

回答by Rohit Vats

Its worked for me though but the namespaceyou included is incorrect. Remove the last backslash at the end. It should be -

虽然它对我有用,但namespace您包含的内容不正确。Remove the last backslash at the end. 它应该是 -

xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"

instead of

代替

xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit/"