C# 如何将WPF扩展工具中的元素添加到网格编程中?

C# 如何将WPF扩展工具中的元素添加到网格编程中?,c#,wpf,xaml,C#,Wpf,Xaml,我需要在c代码中创建一个ColorPicker元素,编辑它并将其添加到网格中。我知道如何创建ex.Label Label label1 = new Label(); grid.Children.Add(label1); 我试过了,但没有成功: ColorPicker colorPicker10= new ColorPicker(); grid.Children.Add(colorPicker10); ColorPicker位于WPF扩展工具中,该工具是通过NuGet添加的。有人知道怎么做吗?

我需要在c代码中创建一个ColorPicker元素,编辑它并将其添加到网格中。我知道如何创建ex.Label

Label label1 = new Label();
grid.Children.Add(label1);
我试过了,但没有成功:

ColorPicker colorPicker10= new ColorPicker();
grid.Children.Add(colorPicker10);
ColorPicker位于WPF扩展工具中,该工具是通过NuGet添加的。有人知道怎么做吗? 这就是我自己在xaml中添加它时的样子:

<xctk:ColorPicker x:Name="colorPicker1" VerticalAlignment="Top"  ShowStandardColors="False" ShowDropDownButton="False" Height="25" Width="25" HorizontalAlignment="Left"/>

使用完全限定名称:

Xceed.Wpf.Toolkit.ColorPicker colorPicker10 = new Xceed.Wpf.Toolkit.ColorPicker();
grid.Children.Add(colorPicker10);
…或在源代码文件顶部添加以下using指令:

using Xceed.Wpf.Toolkit;

它是怎么失败的?请提供有关此问题的更多信息。它不识别ColorPicker类。