Table of Contents

Class NavigationViewItem

Namespace
Wpf.Ui.Controls
Assembly
Wpf.Ui.dll

Represents the container for an item in a NavigationView control. When needed, it can be used as a normal button with a Click action.

[TemplatePart(Name = "PART_ChevronGrid", Type = typeof(Grid))]
public class NavigationViewItem : ButtonBase, IAnimatable, IFrameworkInputElement, IInputElement, ISupportInitialize, IQueryAmbient, IAddChild, ICommandSource, INavigationViewItem, IIconControl
Inheritance
NavigationViewItem
Implements
Inherited Members

Constructors

NavigationViewItem()

public NavigationViewItem()

NavigationViewItem(string, Type)

public NavigationViewItem(string name, Type targetPageType)

Parameters

name string
targetPageType Type

NavigationViewItem(string, SymbolRegular, Type)

public NavigationViewItem(string name, SymbolRegular icon, Type targetPageType)

Parameters

name string
icon SymbolRegular
targetPageType Type

NavigationViewItem(string, SymbolRegular, Type, IList)

public NavigationViewItem(string name, SymbolRegular icon, Type targetPageType, IList menuItems)

Parameters

name string
icon SymbolRegular
targetPageType Type
menuItems IList

NavigationViewItem(Type)

public NavigationViewItem(Type targetPageType)

Parameters

targetPageType Type

Fields

HasMenuItemsProperty

Identifies the HasMenuItems dependency property.

public static readonly DependencyProperty HasMenuItemsProperty

Field Value

DependencyProperty

IconProperty

Identifies the Icon dependency property.

public static readonly DependencyProperty IconProperty

Field Value

DependencyProperty

InfoBadgeProperty

Identifies the InfoBadge dependency property.

public static readonly DependencyProperty InfoBadgeProperty

Field Value

DependencyProperty

IsActiveProperty

Identifies the IsActive dependency property.

public static readonly DependencyProperty IsActiveProperty

Field Value

DependencyProperty

IsExpandedProperty

Identifies the IsExpanded dependency property.

public static readonly DependencyProperty IsExpandedProperty

Field Value

DependencyProperty

IsPaneOpenProperty

Identifies the IsPaneOpen dependency property.

public static readonly DependencyProperty IsPaneOpenProperty

Field Value

DependencyProperty

MenuItemsProperty

Identifies the MenuItems dependency property.

public static readonly DependencyProperty MenuItemsProperty

Field Value

DependencyProperty

MenuItemsSourceProperty

Identifies the MenuItemsSource dependency property.

public static readonly DependencyProperty MenuItemsSourceProperty

Field Value

DependencyProperty

NavigationCacheModeProperty

Identifies the NavigationCacheMode dependency property.

public static readonly DependencyProperty NavigationCacheModeProperty

Field Value

DependencyProperty

TargetPageTagProperty

Identifies the TargetPageTag dependency property.

public static readonly DependencyProperty TargetPageTagProperty

Field Value

DependencyProperty

TargetPageTypeProperty

Identifies the TargetPageType dependency property.

public static readonly DependencyProperty TargetPageTypeProperty

Field Value

DependencyProperty

TemplateElementChevronGrid

protected const string TemplateElementChevronGrid = "PART_ChevronGrid"

Field Value

string

Properties

ChevronGrid

protected Grid? ChevronGrid { get; set; }

Property Value

Grid

HasMenuItems

Gets a value indicating whether MenuItems.Count > 0

[Browsable(false)]
public bool HasMenuItems { get; }

Property Value

bool

Icon

Gets or sets the icon displayed in the MenuItem object.

[Bindable(true)]
public IconElement? Icon { get; set; }

Property Value

IconElement

Id

Gets the unique identifier that allows the item to be located in the navigation.

public string Id { get; }

Property Value

string

InfoBadge

public InfoBadge? InfoBadge { get; set; }

Property Value

InfoBadge

IsActive

Gets a value indicating whether the current element is active.

[Browsable(false)]
public bool IsActive { get; set; }

Property Value

bool

IsExpanded

Gets or sets a value indicating whether the sub-MenuItems are expanded.

[Browsable(false)]
public bool IsExpanded { get; set; }

Property Value

bool

IsMenuElement

public bool IsMenuElement { get; set; }

Property Value

bool

IsPaneOpen

[Browsable(false)]
public bool IsPaneOpen { get; set; }

Property Value

bool

MenuItems

Gets the collection of menu items displayed in the NavigationView.

public IList MenuItems { get; }

Property Value

IList

MenuItemsSource

Gets or sets an object source used to generate the content of the NavigationView menu.

[Bindable(true)]
public object? MenuItemsSource { get; set; }

Property Value

object

NavigationCacheMode

Gets or sets the caching characteristics for a page involved in a navigation.

public NavigationCacheMode NavigationCacheMode { get; set; }

Property Value

NavigationCacheMode

NavigationViewItemParent

Gets or sets the parent if it's in MenuItems collection

public INavigationViewItem? NavigationViewItemParent { get; set; }

Property Value

INavigationViewItem

TargetPageTag

Gets or sets the unique tag used by the parent navigation system for the purpose of searching and navigating.

public string TargetPageTag { get; set; }

Property Value

string

TargetPageType

Gets or sets the type of the page to be navigated. (Should be derived from FrameworkElement).

public Type? TargetPageType { get; set; }

Property Value

Type

Methods

Activate(INavigationView)

Correctly activates

public virtual void Activate(INavigationView navigationView)

Parameters

navigationView INavigationView

Deactivate(INavigationView)

Correctly deactivates

public virtual void Deactivate(INavigationView navigationView)

Parameters

navigationView INavigationView

OnApplyTemplate()

When overridden in a derived class, is invoked whenever application code or internal processes call ApplyTemplate().

public override void OnApplyTemplate()

OnClick()

Raises the Click routed event.

protected override void OnClick()

OnInitialized(EventArgs)

Raises the Initialized event. This method is invoked whenever IsInitialized is set to true internally.

protected override void OnInitialized(EventArgs e)

Parameters

e EventArgs

The RoutedEventArgs that contains the event data.

OnMouseDown(MouseButtonEventArgs)

Is called when mouse is clicked down.

protected override void OnMouseDown(MouseButtonEventArgs e)

Parameters

e MouseButtonEventArgs