asp.net控件设计时支持(3)2011-12-06 博客园 Clingingboy上篇很偷懒的写了自动格式设置.把没讲完的补上.一.智能标记先看一张图.

GridView右侧的小三角可以很轻松的帮助我们设置常用的属性,如下面的启动分页,启用排序等,通过这样的方式我们可以很快的完成工作。我们称这样的任务菜单为智能标记.下面来看看如何实现1.重写ControlDesigner的ActionLists属性你必须重写这个属性,返回你自定义的智能标记集合(即DesignerActionListCollection),这里假设CustomControlActionList为自定义的智能
public class SampleControlDesigner : ControlDesigner { public SampleControlDesigner() : base() { } //创建一个自定义操作列表集合 public override DesignerActionListCollection ActionLists { get { DesignerActionListCollection actionLists = new DesignerActionListCollection(); actionLists.Add(new CustomControlActionList(this)); return actionLists; } } }