CompositeDataBoundControl 的设计器问题
我有一个自定义类:
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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您正在使用哪种设计器类型?通常它是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.