SiteMapPath.CurrentNodeStyle 屬性

定義

取得用於目前節點顯示文字的樣式。

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

屬性值

Style,含有用於在 SiteMapPath 控制項中目前節點顯示文字的樣式設定。

屬性

範例

下列程式碼範例示範如何在Web Form頁面中以宣告方式設定 CurrentNodeStyleSiteMapPath 控制項的 。

<%@ Page language="c#"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="Form1" method="post" runat="server">

      <p><asp:SiteMapPath runat="server" ID="SiteMapPath1"
            RootNodeStyle-Font-Bold="true"
            RootNodeStyle-Font-Names="Arial Black"
            RootNodeStyle-Font-Italic="True"
            RootNodeStyle-ForeColor="Green"
            CurrentNodeStyle-ForeColor="Orange"/></p>

      <p><asp:Label
            id="Label1"
            runat="server"
            Width="441px"
            Height="64px"
            AssociatedControlID="TextBox1">
                Enter your customer service issue in the space
                provided below, and we will get back to you as
                soon as possible.</asp:Label></p>

      <p><asp:TextBox id="TextBox1" runat="server"
          Width="448px" Height="96px"></asp:TextBox></p>

      <p><asp:Button id="Button1" runat="server"
          Width="112px" Text="Submit"></asp:Button></p>
    </form>
  </body>
</html>
<%@ Page language="VB"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
    <form id="Form1" method="post" runat="server">

      <p><asp:SiteMapPath runat="server" ID="SiteMapPath1"
            RootNodeStyle-Font-Bold="true"
            RootNodeStyle-Font-Names="Arial Black"
            RootNodeStyle-Font-Italic="True"
            RootNodeStyle-ForeColor="Green"
            CurrentNodeStyle-ForeColor="Orange"/></p>

      <p><asp:Label
            id="Label1"
            runat="server"
            Width="441px"
            AssociatedControlID="TextBox1"
            Height="64px">Enter your customer service issue in the space
                          provided below, and we will get back to you as
                          soon as possible.</asp:Label></p>

      <p><asp:TextBox id="TextBox1" runat="server"
          Width="448px" Height="96px"></asp:TextBox></p>

      <p><asp:Button id="Button1" runat="server"
          Width="112px" Text="Submit"></asp:Button></p>
    </form>
  </body>
</html>

備註

CurrentNodeStyle使用 屬性可控制代表目前顯示頁面之流覽路徑節點的顯示文字外觀。 根據預設,顯示文字是在 代表頁面之 的 SiteMapNode 屬性中指定的 Title 文字。 常見的樣式設定包括自訂背景色彩、前景色彩、字型屬性和節點間距。

針對 SiteMapPath 節點,樣式屬性會依下列順序合併成單一樣式:

  1. NodeStyle

  2. CurrentNodeStyle 或者,如果目前顯示的頁面是根節點,則 RootNodeStyle 為 。

注意

如果您將節點字型樣式設定為刪除線或上線樣式,除非節點明確設定 true 為 ,否則不會顯示節點的預設底線樣式。

CurrentNodeTemplate如果已定義屬性,則會 CurrentNodeStyle 忽略 屬性。

適用於

另請參閱