ControlDesigner.InTemplateMode 属性


获取一个值,该值指示控件在设计宿主中是否处于模板查看模式或模板编辑模式之一。Gets a value indicating whether the control is in either template viewing or editing mode in the design host. InTemplateMode 属性为只读。The InTemplateMode property is read-only.

 property bool InTemplateMode { bool get(); };
protected bool InTemplateMode { get; }
member this.InTemplateMode : bool
Protected ReadOnly Property InTemplateMode As Boolean


如果控件处于模板查看模式或模板编辑模式之一,则为 true;否则为 falsetrue, if the control is in either template viewing or editing mode; otherwise, false.


当当前正在查看只读模板或在设计宿主(如 Visual Studio 2005Visual Studio 2005)中编辑编辑模板时,Web 服务器控件处于模板模式下。A Web server control is in template mode when a read-only template is currently being viewed or an editable template is being edited in a design host such as Visual Studio 2005Visual Studio 2005.

当关联控件的模板模式发生变化时,ControlDesigner 类提供一个默认的 ViewEventHandler 对象以更新 InTemplateMode 值。The ControlDesigner class supplies a default ViewEventHandler object to update the InTemplateMode value when the template mode changes for the associated control. TemplatedControlDesigner 类派生的自定义设计器可以重写 OnTemplateModeChanged 方法,以便在设计宿主中的控件的模板编辑模式更改时执行附加处理。Custom designers that are derived from the TemplatedControlDesigner class can override the OnTemplateModeChanged method to perform additional processing when the template editing mode changes for a control in the design host.