SiteMapPath.NodeStyle Proprietà

Definizione

Ottiene lo stile utilizzato per il testo visualizzato di tutti i nodi del percorso di navigazione nel sito.

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

Valore della proprietà

L'oggetto Style che contiene le impostazioni di stile per il testo visualizzato nel controllo SiteMapPath.

Attributi

Esempio

Nell'esempio di codice seguente viene illustrato come definire un NodeStyle oggetto unito a per RootNodeStyle illustrare l'ordine di precedenza dello stile per i SiteMapPath nodi.

<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" runat="server">

            <!-- The following example demonstrates some of the orders
                 of precedence when applying styles and templates to
                 functional nodes of a SiteMapPath.

                 The NodeStyle and RootNodeStyle define the same attributes,
                 but are different and conflict with each other: the
                 RootNodeStyle supersedes NodeStyle, and is the style
                 rendered. Notice, however, that the underline style
                 defined by NodeStyle is still applied.

                 Both a CurrentNodeStyle and a CurrentNodeTemplate are
                 defined. A template supersedes a style for a node
                 type, so CurrentNodeTemplate is displayed and CurrentNodeStyle
                 is ignored. -->

            <asp:SiteMapPath ID="SiteMapPath1" runat="server"
                RenderCurrentNodeAsLink="true"
                NodeStyle-Font-Names="Franklin Gothic Medium"
                NodeStyle-Font-Underline="true"
                NodeStyle-Font-Bold="true"
                RootNodeStyle-Font-Names="Symbol"
                RootNodeStyle-Font-Bold="false"
                CurrentNodeStyle-Font-Names="Verdana"
                CurrentNodeStyle-Font-Size="10pt"
                CurrentNodeStyle-Font-Bold="true"
                CurrentNodeStyle-ForeColor="red"
                CurrentNodeStyle-Font-Underline="false">
                <CURRENTNODETEMPLATE>
                        <asp:Image id="Image1" runat="server" ImageUrl="WebForm2.jpg" AlternateText="WebForm2"/>
                </CURRENTNODETEMPLATE>
            </asp:SiteMapPath>


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

<script runat="server">
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <title>ASP.NET Example</title>
</head>
<body>
        <form id="form1" runat="server">

            <!-- The following example demonstrates some of the orders
                 of precedence when applying styles and templates to
                 functional nodes of a SiteMapPath.

                 The NodeStyle and RootNodeStyle define the same attributes,
                 but are different and conflict with each other: the
                 RootNodeStyle supersedes NodeStyle, and is the style
                 rendered. Notice, however, that the underline style
                 defined by NodeStyle is still applied.

                 Both a CurrentNodeStyle and a CurrentNodeTemplate are
                 defined. A template supersedes a style for a node
                 type, so CurrentNodeTemplate is displayed and CurrentNodeStyle
                 is ignored. -->

            <asp:SiteMapPath ID="SiteMapPath1" runat="server"
                RenderCurrentNodeAsLink="true"
                NodeStyle-Font-Names="Franklin Gothic Medium"
                NodeStyle-Font-Underline="true"
                NodeStyle-Font-Bold="true"
                RootNodeStyle-Font-Names="Symbol"
                RootNodeStyle-Font-Bold="false"
                CurrentNodeStyle-Font-Names="Verdana"
                CurrentNodeStyle-Font-Size="10pt"
                CurrentNodeStyle-Font-Bold="true"
                CurrentNodeStyle-ForeColor="red"
                CurrentNodeStyle-Font-Underline="false">
                <CURRENTNODETEMPLATE>
                        <asp:Image id="Image1" runat="server" ImageUrl="WebForm2.jpg" AlternateText="WebForm2"/>
                </CURRENTNODETEMPLATE>
            </asp:SiteMapPath>


        </form>
    </body>
</html>

Commenti

Utilizzare la NodeStyle proprietà per controllare l'aspetto del testo visualizzato per tutti i nodi del percorso di spostamento di cui viene eseguito il rendering dal controllo . Per impostazione predefinita, il testo visualizzato è quello specificato nella Title proprietà dell'oggetto SiteMapNode che rappresenta la pagina. Le impostazioni di stile comuni includono il colore di sfondo personalizzato, il colore di primo piano, le proprietà del carattere e la spaziatura dei nodi.

Per SiteMapPath i nodi, le proprietà di stile vengono unite in un unico stile, nell'ordine seguente:

  1. NodeStyle

  2. CurrentNodeStyle o RootNodeStyle, a seconda del tipo di nodo.

Nota

Se si imposta lo stile del carattere del nodo su uno stile barrato o overline, lo stile di sottolineatura predefinito del nodo non viene visualizzato a meno che non sia impostato in modo esplicito su true.

NodeStyle Se è definito, viene inizialmente applicato a ogni nodo. Se viene definito uno stile aggiuntivo per un particolare tipo di nodo, ad esempio il nodo radice o il nodo corrente, questo stile sostituisce lo stile generale specificato nella NodeStyle proprietà . Se viene definito un modello per un particolare tipo di nodo, sostituisce tutti gli stili definiti per tale nodo.

Si applica a

Vedi anche