Navigation
Last updated
Was this helpful?
Last updated
Was this helpful?
Structr.Navigation package is intended to help organize navigation menu (nav bar) or/and breadcrumbs in web-application.
Navigation package is available on .
Create menu or breadcrumb navigation item.
Navigation services uses different providers to get source navigation data. For example: JSON, XML file, Database, or something else.
You can create custom navigation provider:
And then setup navigation services:
Or you can use one of default implemented navigation provider from list:
Create JSON file with hierarchical navigation:
Setup JSON navigation provider:
Create XML file with hierarchical navigation:
Setup XML navigation provider:
When you setup navigation provider you can configure navigation options represents by NavigationOptions<TNavigationItem>
.
NavigationOptions<TNavigationItem>
properties:
ResourceType
Type
Determines a type of resources file whether uses for localization, null
by default.
ItemFilter
Func<TNavigationItem, bool>
Determines a filter function for navigation items, item => true
by default.
ItemActivator
Func<TNavigationItem, bool>
Determines an activation function for navigation items, item => false
by default.
EnableCaching
bool
Determines whether navigation items should be cached, true
by default.
Example configure navigation services:
NavigationItem<T>
properties:
Id
string
Navigation item identifier.
Title
string
Navigation item title.
ResourceName
string
The key of navigation item in resource file.
Children
IEnumerable<TNavigationItem>
Child navigation elements.
Ancestors
IEnumerable<TNavigationItem>
Returns all parent navigation items.
Descendants
IEnumerable<TNavigationItem>
Returns all child navigation items.
Parent
TNavigationItem
Returns closest parent navigation item.
IsActive
bool
Status of navigation item. Only one navigation item can be active at the same time.
HasChildren
bool
Returns true
if the navigation item has a child, otherwise returns false
.
HasActiveChild
bool
Returns true
if the navigation item has an active child, otherwise returns false
.
HasActiveDescendant
bool
Returns true
if the navigation item has an active descendant, otherwise returns false
.
HasActiveAncestor
bool
Returns true
if the navigation item has an active ancestor, otherwise returns false
.
Navigation services uses to organize or . Both of navigation elements should be inherited from NavigationItem<T>
that represents basic navigation item.