CompositeDataBoundControl 的设计器问题

发布于 2024-09-06 04:36:17 字数 767 浏览 2 评论 0原文

我有一个自定义类:

SimpleTemplatedControl : CompositeDataBoundControl

    private ITemplate _itemTemplate;
    [PersistenceMode(PersistenceMode.InnerProperty),
     TemplateContainer(typeof(SimpleItem)),
    ]
    public ITemplate ItemTemplate
    {
        get { return _itemTemplate; }// get
        set { _itemTemplate = value; }// set
    }   

    protected override int CreateChildControls(
        System.Collections.IEnumerable dataSource, 
        bool dataBinding)
    {
        //
    }

当我将其放在网络表单上时,我会得到一个智能标记,我可以在其中选择数据源控件。相当方便。但是,如果我将此属性添加到此类:

[Designer(typeof(SimpleDesigner))]

我将不再看到该属性,而是看到一个智能标记来填充我的模板(也很方便)。

我希望在同一个智能标记中可以使用这两个选项,就像 GridView 控件一样。如何做到这一点?

I have a custom class:

SimpleTemplatedControl : CompositeDataBoundControl

    private ITemplate _itemTemplate;
    [PersistenceMode(PersistenceMode.InnerProperty),
     TemplateContainer(typeof(SimpleItem)),
    ]
    public ITemplate ItemTemplate
    {
        get { return _itemTemplate; }// get
        set { _itemTemplate = value; }// set
    }   

    protected override int CreateChildControls(
        System.Collections.IEnumerable dataSource, 
        bool dataBinding)
    {
        //
    }

When I drop this on a webform I get such a smart tag in which I can choose a DataSource control. Pretty convinient. However if I add this attribute to this class:

[Designer(typeof(SimpleDesigner))]

I don't get to see that anymore but instead a smart tag to fill in my Template (also handy).

I would like to have both option available from within the same smart tag just like with a GridView control. How to accomplish this?

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

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

发布评论

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

评论(1

深海少女心 2024-09-13 04:36:17

您正在使用哪种设计器类型?通常它是ControlDesigner,但对于CompositeDataBoundControl,您应该使用DataBoundControlDesigner类来继承您的设计器。

格兹,克里斯。

Which is the Designer type you're using? Normally it would be ControlDesigner but for the CompositeDataBoundControl you should use the DataBoundControlDesigner class to inherit your designer from.

Grz, Kris.

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