TreeView.RootNodeStyle 속성

정의

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

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

속성 값

TreeNodeStyle

TreeNodeStyle에 있는 루트 노드의 스타일을 나타내는 TreeView에 대한 참조입니다.

특성

예제

다음 코드 예제에 사용 하는 방법을 보여 줍니다.는 RootNodeStyle 속성에 대 한 루트 노드의 모양을 제어 하는 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 RootNodeStyle Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>TreeView RootNodeStyle Example</h3>
      
      <!-- Declaratively set the RootNodeStyle settings. --> 
      <asp:TreeView id="LinksTreeView"
        RootNodeStyle-ForeColor="Green"
        RootNodeStyle-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 RootNodeStyle Example</title>
</head>
<body>
    <form id="form1" runat="server">
    
      <h3>TreeView RootNodeStyle Example</h3>
      
      <!-- Declaratively set the RootNodeStyle settings. --> 
      <asp:TreeView id="LinksTreeView"
        RootNodeStyle-ForeColor="Green"
        RootNodeStyle-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>

설명

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

  1. NodeStyle.

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

  3. SelectedNodeStyle

  4. HoverNodeStyle.

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

적용 대상

추가 정보