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 Forms页中以声明方式设置 CurrentNodeStyle 控件的 SiteMapPath

<%@ 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属性。

适用于

另请参阅