WebPartZoneBase.SelectedPartChromeStyle 属性

定义

获取区域中选定的 WebPart 控件的外观的样式信息。

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; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.SelectedPartChromeStyle : System.Web.UI.WebControls.Style
Public ReadOnly Property SelectedPartChromeStyle As Style

属性值

Style

包含选定的 Style 控件的样式信息的 WebPart

属性

示例

下面的代码示例演示控件上WebPartZone属性的SelectedPartChromeStyle声明性用法。 有关完整代码示例,包括代码隐藏源文件和包含此代码中的区域的 .aspx 页,请参阅 WebPartZoneBase 类概述。

请注意,该 SelectedPartChromeStyle 属性在声明性标记中为其分配了一个值。 此值会影响 WebPartZone1。 将页面加载到浏览器中后,将页面切换到编辑模式。 在其中一个 WebPart 控件的谓词菜单上,单击该谓词以编辑控件,并注意控件的背景色将更改为声明性标记中分配给它的颜色。

<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>

注解

此属性SelectedPartChromeStyle允许在Web 部件页面处于编辑模式时访问区域中所选WebPart控件的样式特征。

适用于

另请参阅