TreeView.NodeStyle 속성

정의

TreeNodeStyle 컨트롤에 있는 노드의 기본 모양을 설정하는 데 사용할 수 있는 TreeView 개체에 대한 참조를 가져옵니다.

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

속성 값

TreeNodeStyle

노드의 기본 스타일을 나타내는 TreeNodeStyle에 대한 참조입니다.

특성

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 NodeStyle 속성에 있는 노드의 모양을 제어 하는 TreeView 컨트롤.


<%@ 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>TreeView NodeStyle Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>TreeView NodeStyle Example</h3>
      
      <!-- Declaratively set the NodeStyle settings. --> 
      <asp:TreeView id="LinksTreeView"
        NodeStyle-ForeColor="Green"
        NodeStyle-VerticalPadding="0"  
        runat="server">
         
        <Nodes>
        
          <asp:TreeNode Value="Home" 
            NavigateUrl="Home.aspx" 
            Text="Home"
            Target="Content" 
            Expanded="True">
             
            <asp:TreeNode Value="Page 1" 
              NavigateUrl="Page1.aspx" 
              Text="Page1"
              Target="Content">
               
              <asp:TreeNode Value="Section 1" 
                NavigateUrl="Section1.aspx" 
                Text="Section 1"
                Target="Content"/>
                 
            </asp:TreeNode>              
            
            <asp:TreeNode Value="Page 2" 
              NavigateUrl="Page2.aspx"
              Text="Page 2"
              Target="Content">
               
            </asp:TreeNode> 
            
          </asp:TreeNode>
        
        </Nodes>
        
      </asp:TreeView>

    </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>TreeView NodeStyle Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>TreeView NodeStyle Example</h3>
      
      <!-- Declaratively set the NodeStyle settings. --> 
      <asp:TreeView id="LinksTreeView"
        NodeStyle-ForeColor="Green"
        NodeStyle-VerticalPadding="0"  
        runat="server">
         
        <Nodes>
        
          <asp:TreeNode Value="Home" 
            NavigateUrl="Home.aspx" 
            Text="Home"
            Target="Content" 
            Expanded="True">
             
            <asp:TreeNode Value="Page 1" 
              NavigateUrl="Page1.aspx" 
              Text="Page1"
              Target="Content">
               
              <asp:TreeNode Value="Section 1" 
                NavigateUrl="Section1.aspx" 
                Text="Section 1"
                Target="Content"/>
                 
            </asp:TreeNode>              
            
            <asp:TreeNode Value="Page 2" 
              NavigateUrl="Page2.aspx"
              Text="Page 2"
              Target="Content">
               
            </asp:TreeNode> 
            
          </asp:TreeNode>
        
        </Nodes>
        
      </asp:TreeView>

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

설명

사용 하 여는 NodeStyle 속성에 있는 노드의 기본 모양을 제어 하는 TreeView 컨트롤입니다. 이 속성은 읽기 전용입니다. 그러나의 속성을 설정할 수는 TreeNodeStyle 개체를 반환 합니다. 속성 형식에서 선언적으로 설정할 수 있습니다 Property-Subproperty, 여기서 Subproperty 속성인 합니다 TreeNodeStyle 개체 (예를 들어 NodeStyle-ForeColor). 형식에서 속성을 프로그래밍 방식으로 설정할 수도 있습니다 Property.Subproperty (예를 들어 NodeStyle.ForeColor). 일반적인 설정에는 일반적으로 사용자 지정 배경색, 전경색, 글꼴 속성 및 노드 간격 포함 됩니다. 스타일 속성의 우선 순위 순서로 적용 됩니다.

  1. NodeStyle.

  2. RootNodeStyle하십시오 ParentNodeStyle, 또는 LeafNodeStyle노드 형식에 따라 합니다. 경우는 LevelStyles 컬렉션이 정의 된, 다른 노드 스타일 속성을 재정의이 이번에 적용 됩니다.

  3. SelectedNodeStyle.

  4. HoverNodeStyle.

참고

해당 노드 스타일 설정 합니다 RootNodeStyle, ParentNodeStyle, 또는 LeafNodeStyle 속성의 스타일 설정을 재정의 NodeStyle 속성입니다.

특정 수준의 노드 자식 노드가 있는지 여부에 관계 없이 동일한 모양을 해야 하는 내용을 스타일 탐색 메뉴의 테이블을 생성 해야 할 수도 있습니다를 사용 하는 LevelStyles 개인 설정 하는 대신 속성 스타일 속성입니다.

적용 대상

추가 정보