次の方法で共有


WebPartDescription.Title プロパティ

定義

対応する WebPart コントロールのタイトルのテキストを取得します。

public:
 property System::String ^ Title { System::String ^ get(); };
public string Title { get; }
member this.Title : string
Public ReadOnly Property Title As String

プロパティ値

対応するコントロールのタイトルを含む文字列。 既定値は、.NET Framework によって提供される、計算済みの文字列です。

次のコード例では、 プロパティをプログラムで使用する方法を Title 示します。 このコード例を実行するために必要な完全なコードについては、クラスの概要に関するトピックの「例」セクションを WebPartDescription 参照してください。

Web ページの メソッドのButton1_Click次のコードは、 メソッドを使用してGetAvailableWebPartDescriptionsカタログ内のオブジェクトのWebPartDescriptionコレクションを取得し、そのオブジェクトをループ処理してカタログ内の各WebPartコントロールの詳細を表示する方法をWebPartDescription示しています。 プロパティ値は次の Title コードで取得されることに注意してください。

protected void Button1_Click(object sender, EventArgs e)
{
  Label1.Text = String.Empty;
  
  WebPartDescriptionCollection descriptions = 
    DeclarativeCatalogPart1.GetAvailableWebPartDescriptions();

  foreach (WebPartDescription desc in descriptions)
  {
    Label1.Text += "ID: " + desc.ID + "<br />" +
      "Title: " + desc.Title + "<br />" +
      "Description: " + desc.Description + "<br />" +
      "ImageUrl: " + desc.CatalogIconImageUrl + "<br />" +
      "<hr />";
  }
}
Protected Sub Button1_Click(ByVal sender As Object, _
  ByVal e As System.EventArgs)
  
  Label1.Text = String.Empty
      
  Dim descriptions As WebPartDescriptionCollection = _
   DeclarativeCatalogPart1.GetAvailableWebPartDescriptions()
          
  Dim desc As WebPartDescription
      
  For Each desc In descriptions
    Label1.Text += "ID: " & desc.ID & "<br />" & _
      "Title: " & desc.Title & "<br />" & _
      "Description: " & desc.Description & "<br />" & _
      "ImageUrl: " & desc.CatalogIconImageUrl & "<br />" & _
      "<hr />"
  Next
  
End Sub

注釈

プロパティの Title 値は、 プロパティに WebPart.DisplayTitle 直接対応します。 対応する WebPart コントロールがプロパティに対して DisplayTitle 持つものに関係なく、プロパティの値になります。それ以外の Title 場合、タイトルは計算値です。

プロパティは Title 、ページがカタログ表示モードで、 WebPart コントロールがコントロールのカタログに表示されている場合にのみ適用されます。 コントロールに割り当てられているタイトルは、 WebPart カタログ内のコントロールの横に表示されます。

適用対象

こちらもご覧ください