必须使用什么命名空间来获取 DataGridComboBoxColumn?

发布于 2024-08-05 18:47:57 字数 590 浏览 4 评论 0原文

我正在 WPF 中用 C# 3.5 编写一个应用程序。我想以编程方式将 C# 中的 DataGridComboBoxColumn 添加到 WPF 工具包 DataGrid。问题是控件本身似乎不存在,因为我缺少指令或程序集。我认为 System.Windows.Controls 并通过添加对 WPFToolkit 的引用可以处理这个问题,但它似乎不是......我错过了什么吗?

我发现奇怪的是,在 XAML 中创建 DataGridComboBoxColumn 根本没有问题...

这是我想要完成的示例:

SomeDataGrid.Columns.Add(new DataGridComboBoxColumn()
{
    Header="ColumnHeader", 
    //...
});

*编辑:通过更多地了解我的问题...我想知道以及如何在 C# 中执行等效的 XAML:

<Window xmlns:WPFToolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit">
</Window>

I am writing an app in C# 3.5 in WPF. I want to programmatically add a DataGridComboBoxColumn in C# to a WPF toolkit DataGrid. The problem is that the control itself seems to not exist because I am missing either a directive or an assembly. I thought that System.Windows.Controls and by adding a reference to the WPFToolkit would handle this but it seems to not be... Am I missing something?

What I find odd is that in XAML there is no problem at all to create a DataGridComboBoxColumn...

Here is an example of what I am trying to accomplish:

SomeDataGrid.Columns.Add(new DataGridComboBoxColumn()
{
    Header="ColumnHeader", 
    //...
});

*Edit: By understanding a bit more my problem... I want to know also how you can do the equivalent XAML in C#:

<Window xmlns:WPFToolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit">
</Window>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

指尖凝香 2024-08-12 18:47:57

程序集 WpfToolkit,命名空间:Microsoft.Windows.Controls。

Assembly WpfToolkit, namespace: Microsoft.Windows.Controls.

鸩远一方 2024-08-12 18:47:57

的“Programming Microsoft Windows Forms - Charles Petzold - Microsoft Press”第 300 页的示例

在 VS 2005 中,以下显示使用 System

;使用系统绘图;

使用 System.Windows.Forms;

埃德温

In VS 2005 the following show in the example on page 300 of "Programming Microsoft Windows Forms - Charles Petzold - Microsoft Press"

using System;

using System.Drawing;

using System.Windows.Forms;

Edwin

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文