SiteMapPath.NodeStyle Propriété

Définition

Obtient le style utilisé pour le texte affiché appliqué à tous les nœuds du chemin de navigation du site.

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

Valeur de propriété

Le Style qui contient les paramètres de style appliqués au texte affiché dans le contrôle SiteMapPath.

Attributs

Exemples

L’exemple de code suivant montre comment définir un NodeStyle qui est fusionné avec un RootNodeStyle pour illustrer l’ordre de priorité du style pour les SiteMapPath nœuds.

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

Remarques

Utilisez la NodeStyle propriété pour contrôler l’apparence du texte d’affichage pour tous les nœuds de chemin de navigation rendus par le contrôle. Par défaut, le texte d’affichage est celui spécifié dans la Title propriété du SiteMapNode qui représente la page. Les paramètres de style courants incluent la couleur d’arrière-plan personnalisée, la couleur de premier plan, les propriétés de police et l’espacement des nœuds.

Pour SiteMapPath les nœuds, les propriétés de style sont fusionnées en un seul style, dans l’ordre suivant :

  1. NodeStyle

  2. CurrentNodeStyle ou RootNodeStyle, selon le type de nœud.

Notes

Si vous définissez le style de police du nœud sur un style barré ou overline, le style de soulignement par défaut du nœud n’est pas affiché, sauf s’il est explicitement défini sur true.

Si est NodeStyle défini, il est initialement appliqué à chaque nœud. Si un style supplémentaire est défini pour un type particulier de nœud, tel que le nœud racine ou le nœud actuel, ce style remplace le style général spécifié dans la NodeStyle propriété . Si un modèle est défini pour un type particulier de nœud, il remplace tous les styles définis pour ce nœud.

S’applique à

Voir aussi