在 silverlight MainPage xaml 代码后面找到 DataGridTextColumn 命名空间,但在 silverlight 库中找不到

发布于 2024-11-26 02:45:19 字数 883 浏览 6 评论 0原文

我在 silverlightapp 主页代码后面成功使用了 DataGridTextColumn。

这是有效的:

using System.Windows.Controls; 
namespace myNamespace
{
    public partial class MainPage
    {
        <snip>
        private DataGridTextColumn CreateTextColumn(...)
        {
            DataGridTextColumn column = new DataGridTextColumn();
            <snip>
        }
    }
}

我想将该方法移动到 silverlight 库中的静态类

using System.Windows.Controls;

namespace myNamespace
{
    public static class DataGridBuilder
    {

        private static DataGridTextColumn CreateTextColumn(...)
        {
            DataGridTextColumn column = new DataGridTextColumn();
        }
     }
}

Intellisense 没有看到 DataGridTextColumn 的定义,并且它也不会编译。我在这两个项目中都有对 System.Windows.Controls 的引用。 MSDN 说我有正确的命名空间。我缺少什么?注意:非工作代码部分中的类名浅蓝色是由 StackOverflow 放置的,而不是智能感知。

I'm successfully using DataGridTextColumn in a silverlightapp main page code behind.

This works:

using System.Windows.Controls; 
namespace myNamespace
{
    public partial class MainPage
    {
        <snip>
        private DataGridTextColumn CreateTextColumn(...)
        {
            DataGridTextColumn column = new DataGridTextColumn();
            <snip>
        }
    }
}

I want to move the method to a static class in a silverlight library

using System.Windows.Controls;

namespace myNamespace
{
    public static class DataGridBuilder
    {

        private static DataGridTextColumn CreateTextColumn(...)
        {
            DataGridTextColumn column = new DataGridTextColumn();
        }
     }
}

Intellisense is not seeing a definition for DataGridTextColumn, and it won't compile either. I have a reference to System.Windows.Controls in both projects. MSDN says I have the right namespace. What am I missing? NOTE: class name light blue coloring in non-working code section is put there by StackOverflow, not intellisense.

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

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

发布评论

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

评论(1

倚栏听风 2024-12-03 02:45:19

程序集是System.Windows.Controls.Data,而命名空间是System.Windows.Controls

您有对 System.Windows.Controls.Data 的引用吗?

The assembly is System.Windows.Controls.Data while the namespace is System.Windows.Controls.

Do you have a reference to System.Windows.Controls.Data?

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