SaaS CMS has officially launched! Learn more now.

Class MenuNode

Class that represents a MenuNode and its children.

Inheritance
System.Object
MenuNode
Implements
System.IComparable<MenuNode>
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Shell.Navigation
Assembly: EPiServer.Shell.dll
Version: 10.10.4
Syntax
public class MenuNode : IComparable<MenuNode>

Constructors

MenuNode(MenuNode, MenuItem)

Initializes a new instance of the MenuNode class.

Declaration
public MenuNode(MenuNode parent, MenuItem current)
Parameters
Type Name Description
MenuNode parent

The parent menu node.

MenuItem current

Menu item

MenuNode(MenuNode, MenuItem, IEnumerable<MenuNode>)

Initializes a new instance of the MenuNode class.

Declaration
public MenuNode(MenuNode parent, MenuItem current, IEnumerable<MenuNode> children)
Parameters
Type Name Description
MenuNode parent

The parent menu node.

MenuItem current

Menu item

System.Collections.Generic.IEnumerable<MenuNode> children

The immediate child nodes to this node.

Properties

Children

Child menu items

Declaration
public ICollection<MenuNode> Children { get; }
Property Value
Type Description
System.Collections.Generic.ICollection<MenuNode>

Current

Menu item

Declaration
public MenuItem Current { get; }
Property Value
Type Description
MenuItem

IsSelected

Gets or sets a value indicating whether this node is selected

Declaration
public bool IsSelected { get; set; }
Property Value
Type Description
System.Boolean
Remarks

This will set the selection to all its parents.

Parent

Parent node, Is null if it a top node

Declaration
public MenuNode Parent { get; }
Property Value
Type Description
MenuNode

Methods

CompareTo(MenuNode)

Compares the current object with another object of the same type. The comparison is made by comparing the integer value Current.SortIndex.

Declaration
public int CompareTo(MenuNode other)
Parameters
Type Name Description
MenuNode other

An object to compare with this object.

Returns
Type Description
System.Int32

A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has the following meanings: Value Meaning Less than zero This object is less than the other parameter. Zero This object is equal to other. Greater than zero This object is greater than other.

Find(String)

Finds a MenuNode.

Declaration
public MenuNode Find(string path)
Parameters
Type Name Description
System.String path

The path to search for

Returns
Type Description
MenuNode

Returns the MenuNode matching the path, otherwise null.

Render(TextWriter, RequestContext)

Renders a menu node and it's children.

Declaration
public void Render(TextWriter writer, RequestContext request)
Parameters
Type Name Description
System.IO.TextWriter writer

The writer.

System.Web.Routing.RequestContext request

The request used for filtering by access.

RenderEnd(TextWriter)

Renders the end of the menu node.

Declaration
protected virtual void RenderEnd(TextWriter writer)
Parameters
Type Name Description
System.IO.TextWriter writer

The writer.

RenderStart(TextWriter)

Renders the start of menu node.

Declaration
protected virtual void RenderStart(TextWriter writer)
Parameters
Type Name Description
System.IO.TextWriter writer

The writer.

SortChildren()

Sort the list of menu items

Declaration
public void SortChildren()

Implements

System.IComparable<T>

Extension Methods