テンプレートの閲覧または編集をデザイナで許可するかどうかを示す値を取得します。
Public ReadOnly Property CanEnterTemplateMode As Boolean
[C#]
public bool CanEnterTemplateMode {get;}
[C++]
public: __property bool get_CanEnterTemplateMode();
[JScript]
public function get CanEnterTemplateMode() : Boolean;
プロパティ値
デザイナによりテンプレートの表示または編集ができる場合は true 。それ以外の場合は false 。
使用例
[Visual Basic] オーバーライドされたバージョンの System.Collections.ControlDesigner.GetEmptyDesignTimeHtml メソッドで CanEnterTemplateMode プロパティの値をチェックするコード例を次に示します。プロパティが返す値が true の場合は、デザイン時画面でテンプレートを編集できます。値が false の場合は、テンプレートを編集するには HTML ビューに切り替える必要があることを伝えるメッセージが表示されます。
' Override the GetEmptyDesignTimeHtml to check whether
' template mode can be used from the designer, and provide
' display messages for both cases.
Protected Overrides Function GetEmptyDesignTimeHtml() As String
Dim textValue As String
If CanEnterTemplateMode Then
textValue = "Right click and choose a set of templates to edit their content.<br>The ItemTemplate is required."
Else
textValue = "Switch to HTML view to edit the control's templates.<br>The ItemTemplate is required."
End If
Return CreatePlaceHolderDesignTimeHtml(textValue)
End Function
[C#, C++, JScript] C#、C++、および JScript のサンプルはありません。Visual Basic のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 2000, Windows XP Professional, Windows Server 2003 ファミリ
.NET Framework セキュリティ:
- 直前の呼び出し元の完全信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細の参照先 : 部分信頼コードからのライブラリの使用
参照
TemplatedControlDesigner クラス | TemplatedControlDesigner メンバ | System.Web.UI.Design 名前空間