WebPartZoneBase.SelectedPartChromeStyle 属性

定义

获取区域中选定的 WebPart 控件的外观的样式信息。Gets style information for the appearance of a selected WebPart control in a zone.

public:
 property System::Web::UI::WebControls::Style ^ SelectedPartChromeStyle { System::Web::UI::WebControls::Style ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public System.Web.UI.WebControls.Style SelectedPartChromeStyle { get; }
member this.SelectedPartChromeStyle : System.Web.UI.WebControls.Style
Public ReadOnly Property SelectedPartChromeStyle As Style

属性值

包含选定的 Style 控件的样式信息的 WebPartA Style that contains style information for the selected WebPart control.

属性

示例

下面的代码示例演示了 WebPartZone 控件上 SelectedPartChromeStyle 属性的声明性用法。The following code example demonstrates the declarative use of the SelectedPartChromeStyle property on a WebPartZone control. 有关完整的代码示例,包括代码隐藏源文件和包含此代码中区域的 .aspx 页面,请参阅 WebPartZoneBase 类概述。For the full code example, including the code-behind source file and the .aspx page that contains the zone in this code, see the WebPartZoneBase class overview.

请注意,在声明性标记中,SelectedPartChromeStyle 属性有一个分配给它的值。Notice that the SelectedPartChromeStyle property has a value assigned to it in the declarative markup. 此值会影响 WebPartZone1This value impacts WebPartZone1. 将页面加载到浏览器中后,将页面切换到编辑模式。After you load the page into a browser, switch the page into edit mode. 在其中一个 WebPart 控件的谓词菜单上,单击要编辑该控件的谓词,并注意,该控件的背景色会更改为声明性标记中分配给它的颜色。On the verbs menu for one of the WebPart controls, click the verb to edit the control, and note that the background color of the control changes to the color assigned to it in the declarative markup.

<asp:WebPartZone 
  ID="WebPartZone1" 
  Runat="server"
  LayoutOrientation="Vertical" >
  <EditVerb Text="Edit WebPart" />
  <SelectedPartChromeStyle BackColor="LightBlue" />
  <ZoneTemplate>
    <asp:BulletedList 
      ID="BulletedList1" 
      Runat="server"
      DisplayMode="HyperLink" 
      Title="Favorite Links" >
      <asp:ListItem Value="http://msdn.microsoft.com">
        MSDN
      </asp:ListItem>
      <asp:ListItem Value="http://www.asp.net">
        ASP.NET
      </asp:ListItem>
      <asp:ListItem Value="http://www.msn.com">
        MSN
      </asp:ListItem>
    </asp:BulletedList>
    <asp:Calendar ID="Calendar1" Runat="server" 
      Title="My Calendar" />
  </ZoneTemplate>
</asp:WebPartZone>
<asp:WebPartZone 
  ID="WebPartZone1" 
  Runat="server"
  LayoutOrientation="Vertical" >
  <EditVerb Text="Edit WebPart" />
  <SelectedPartChromeStyle BackColor="LightBlue" />
  <ZoneTemplate>
    <asp:BulletedList 
      ID="BulletedList1" 
      Runat="server"
      DisplayMode="HyperLink" 
      Title="Favorite Links" >
      <asp:ListItem Value="http://msdn.microsoft.com">
        MSDN
      </asp:ListItem>
      <asp:ListItem Value="http://www.asp.net">
        ASP.NET
      </asp:ListItem>
      <asp:ListItem Value="http://www.msn.com">
        MSN
      </asp:ListItem>
    </asp:BulletedList>
    <asp:Calendar ID="Calendar1" Runat="server" 
      Title="My Calendar" />
  </ZoneTemplate>
</asp:WebPartZone>

注解

当 Web 部件页面处于编辑模式时,SelectedPartChromeStyle 属性可用于访问区域中选定 WebPart 控件的样式特征。The SelectedPartChromeStyle property allows you to access style characteristics for the selected WebPart control in a zone when a Web Parts page is in edit mode.

适用于

另请参阅