HierarchicalDataBoundControlDesigner クラスとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > HierarchicalDataBoundControlDesigner クラスの意味・解説 

HierarchicalDataBoundControlDesigner クラス

メモ : このクラスは、.NET Framework version 2.0新しく追加されたものです。

HierarchicalDataBoundControl コントロールを、デザイナ ホストで、デザイン時に使用できるようにします。

名前空間: System.Web.UI.Design.WebControls
アセンブリ: System.Design (system.design.dll 内)
構文構文

Public Class HierarchicalDataBoundControlDesigner
    Inherits BaseDataBoundControlDesigner
Dim instance As HierarchicalDataBoundControlDesigner
public class HierarchicalDataBoundControlDesigner
 : BaseDataBoundControlDesigner
public ref class HierarchicalDataBoundControlDesigner
 : public BaseDataBoundControlDesigner
public class HierarchicalDataBoundControlDesigner
 extends BaseDataBoundControlDesigner
public class HierarchicalDataBoundControlDesigner
 extends BaseDataBoundControlDesigner
解説解説

デザイナ ホストで、ソース ビューからデザイン ビュー切り替えると、HierarchicalDataBoundControl 抽象クラスから派生したコントロール記述するマークアップソース コード解析されコントロールデザインバージョンデザイン サーフェイス作成されます。元のソース ビュー切り替えると、デザイン時のコントロールマークアップソース コード保持されWeb ページマークアップ反映されます。HierarchicalDataBoundControlDesigner クラスは、HierarchicalDataBoundControl から派生したコントロールを、デザイン時にデザイナ ホスト使用できるようにします。

HierarchicalDataBoundControlDesigner クラスプロパティは、次の機能提供します

HierarchicalDataBoundControlDesigner クラスメソッドは、次の機能提供します

使用例使用例

HierarchicalDataBoundControlDesigner クラス拡張しHierarchicalDataBoundControl コントロールか派生したコントロール外観デザイン時に変更するコード例次に示します

この例では、MyHierarchicalDataBoundControl クラスHierarchicalDataBoundControl から派生させています。MyHierarchicalDataBoundControl クラスは、単に HierarchicalDataBoundControlコピーです。また、この例では、HierarchicalDataBoundControlDesigner クラスから MyHierarchicalDataBoundControlDesigner クラス派生させ、MyHierarchicalDataBoundControlDesigner の DesignerAttribute オブジェクトMyHierarchicalDataBoundControl クラス配置します

MyHierarchicalDataBoundControlDesigner は、PreFilterProperties メソッドオーバーライドし、デザイン時に、[プロパティ] グリッドNamingContainer プロパティ表示しますデザイン時のマークアップnull 参照 (Visual Basic では Nothing) または Empty である場合、またはデザイン時のマークアップが空の <span> ブロックである場合 (つまり、<span ...> タグ</span> タグの間に内部マークアップない場合) は、GetDesignTimeHtml メソッドオーバーライドしてプレースホルダのマークアップ生成します

Imports System
Imports System.IO
Imports System.Web
Imports System.Drawing
Imports System.Web.UI.WebControls
Imports System.Web.UI.Design.WebControls
Imports System.Collections
Imports System.ComponentModel
Imports System.Security.Permissions

Namespace Examples.VB.WebControls.Design

    ' The MyHierarchicalDataBoundControl is a copy of the 
    ' HierarchicalDataBoundControl.
    <AspNetHostingPermission(SecurityAction.Demand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    <AspNetHostingPermission(SecurityAction.InheritanceDemand, _
        Level:=AspNetHostingPermissionLevel.Minimal)> _
    <Designer(GetType(Examples.VB.WebControls.Design. _
        MyHierarchicalDataBoundControlDesigner))> _
    Public Class MyHierarchicalDataBoundControl
        Inherits HierarchicalDataBoundControl
    End Class ' MyHierarchicalDataBoundControl

    ' Override members of the HierarchicalDataBoundControlDesigner.
    <ReflectionPermission(SecurityAction.Demand, Flags:=ReflectionPermissionFlag.MemberAccess)>
 _
    Public Class MyHierarchicalDataBoundControlDesigner
        Inherits HierarchicalDataBoundControlDesigner

        Private Const bracketClose As
 String = ">"
        Private Const spanOpen As
 String = "<SPAN"
        Private Const spanClose As
 String = "</SPAN>"

        ' Return the markup for a placeholder, if the inner markup is
 empty.
        ' For brevity, the code that is used to detect embedded white_space
 
        ' in the tags is not shown.
        Public Overrides Function
 GetDesignTimeHtml() As String

            ' Get the design-time markup from the base method.
            Dim markup As String
 = MyBase.GetDesignTimeHtml()

            ' If the markup is null or empty, return the markup 
            ' for the placeholder.
            If markup Is Nothing
 OrElse markup = String.Empty Then
                Return GetEmptyDesignTimeHtml()
            End If

            ' Make the markup uniform case so that the IndexOf will
 work.
            Dim markupUC As String
 = markup.ToUpper()
            Dim charX As Integer

            ' Look for a <span ...> tag.
            charX = markupUC.IndexOf(spanOpen)
            If charX >= 0 Then

                ' Find closing bracket of span open tag.
                charX = markupUC.IndexOf(bracketClose, charX + spanOpen.Length)
                If charX >= 0 Then

                    ' If the inner markup of <span ...></span>
 is empty, 
                    ' return the markup for a placeholder.
                    If String.Compare(markupUC,
 charX + 1, _
                        spanClose, 0, spanClose.Length) = 0 Then

                        Return GetEmptyDesignTimeHtml()
                    End If
                End If
            End If

            ' Return the original markup, if the inner markup is not
 empty.
            Return markup
        End Function ' GetDesignTimeHtml

        ' Shadow the control properties with design-time properties.
        Protected Overrides Sub
 PreFilterProperties( _
            ByVal properties As IDictionary)

            Dim namingContainer As String
 = "NamingContainer"

            ' Call the base method first.
            MyBase.PreFilterProperties(properties)

            ' Make the NamingContainery visible in the Properties grid.
            Dim selectProp As PropertyDescriptor
 = _
                CType(properties(namingContainer), PropertyDescriptor)
            properties(namingContainer) = _
                TypeDescriptor.CreateProperty(selectProp.ComponentType, _
                    selectProp, BrowsableAttribute.Yes)
        End Sub ' PreFilterProperties
    End Class ' MyHierarchicalDataBoundControlDesigner
End Namespace ' Examples.VB.WebControls.Design
using System;
using System.IO;
using System.Web;
using System.Drawing;
using System.Web.UI.WebControls;
using System.Web.UI.Design.WebControls;
using System.Collections;
using System.ComponentModel;
using System.Security.Permissions;

namespace Examples.CS.WebControls.Design
{
    // The MyHierarchicalDataBoundControl is a copy of the 
    // HierarchicalDataBoundControl.
    [AspNetHostingPermission(SecurityAction.Demand, 
        Level = AspNetHostingPermissionLevel.Minimal)]
    [AspNetHostingPermission(SecurityAction.InheritanceDemand, 
        Level = AspNetHostingPermissionLevel.Minimal)]
    [Designer(typeof(Examples.CS.WebControls.Design.
        MyHierarchicalDataBoundControlDesigner))]
    public class MyHierarchicalDataBoundControl
 : 
        HierarchicalDataBoundControl
    {
    } // MyHierarchicalDataBoundControl

    // Override members of the ierarchicalDataBoundControlDesigner.
    [ReflectionPermission(SecurityAction.Demand, Flags=ReflectionPermissionFlag.MemberAccess)]
    public class MyHierarchicalDataBoundControlDesigner
 : 
        HierarchicalDataBoundControlDesigner
    {
        const string bracketClose = ">";
        const string spanOpen = "<SPAN";
        const string spanClose = "</SPAN>";

        // Return the markup for a placeholder, if the inner markup
 is empty.
        // For brevity, the code that is used to detect embedded white_space
 
        // in the tags is not shown.
        public override string GetDesignTimeHtml()
        {
            // Get the design-time markup from the base method.
            string markup = base.GetDesignTimeHtml();

            // If the markup is null or empty, return the markup 
            // for the placeholder.
            if(markup == null || markup ==
 string.Empty)
                return GetEmptyDesignTimeHtml();

            // Make the markup uniform case so that the IndexOf will
 work.
            string MARKUP = markup.ToUpper();
            int charX;

            // Look for a <span ...> tag.
            if ((charX = MARKUP.IndexOf(spanOpen)) >= 0)
            {
                // Find closing bracket of span open tag.
                if ((charX = MARKUP.IndexOf(bracketClose, 
                        charX+spanOpen.Length)) >= 0)
                {
                    // If the inner markup of <span ...></span>
 is empty, 
                    // return the markup for a placeholder.
                    if (string.Compare(MARKUP,
 charX + 1, spanClose, 0, 
                                        spanClose.Length) == 0)

                        return GetEmptyDesignTimeHtml();
                }
            }
            // Return the original markup, if the inner markup is not
 empty.
            return markup;
        }

        // Shadow the control properties with design-time properties.
        protected override void PreFilterProperties(IDictionary
 properties)
        {
            string namingContainer = "NamingContainer";

            // Call the base method first.
            base.PreFilterProperties(properties);

            // Make the NamingContainery visible in the Properties grid.
            PropertyDescriptor selectProp =
                (PropertyDescriptor)properties[namingContainer];
            properties[namingContainer] =
                TypeDescriptor.CreateProperty(selectProp.ComponentType,
                    selectProp, BrowsableAttribute.Yes);
        } // PreFilterProperties
    } // MyHierarchicalDataBoundControlDesigner
} // Examples.CS.WebControls.Design
継承階層継承階層
System.Object
   System.ComponentModel.Design.ComponentDesigner
     System.Web.UI.Design.HtmlControlDesigner
       System.Web.UI.Design.ControlDesigner
         System.Web.UI.Design.WebControls.BaseDataBoundControlDesigner
          System.Web.UI.Design.WebControls.HierarchicalDataBoundControlDesigner
             System.Web.UI.Design.WebControls.MenuDesigner
             System.Web.UI.Design.WebControls.TreeViewDesigner
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
HierarchicalDataBoundControlDesigner メンバ
System.Web.UI.Design.WebControls 名前空間
HierarchicalDataBoundControl
DataBoundControlDesigner クラス
その他の技術情報
ASP.NET コントロール デザイナ概要
チュートリアル : Web サーバー コントロール用の基本的なコントロール デザイナ作成



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「HierarchicalDataBoundControlDesigner クラス」の関連用語

HierarchicalDataBoundControlDesigner クラスのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



HierarchicalDataBoundControlDesigner クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS