Skip to content

Latest commit

 

History

History
59 lines (39 loc) · 2.1 KB

navigationviewitem_icon.md

File metadata and controls

59 lines (39 loc) · 2.1 KB
-api-id -api-type
P:Microsoft.UI.Xaml.Controls.NavigationViewItem.Icon
winrt property

Microsoft.UI.Xaml.Controls.NavigationViewItem.Icon

-description

Gets or sets the icon to show next to the menu item text.

-property-value

The icon to show next to the menu item text. The default is null.

-remarks

You can assign a value from the Symbol enumeration, or a Unicode string that references a glyph in the Segoe MDL2 Assets font.

You can use the Character Map application that comes with Windows to browse the font's glyphs and find their Unicode values. Then, use the format "&#x/(UNICODE);" in XAML, or the format "\u/(UNICODE)" in code, where (UNICODE) is the value of the glyph that indicates the location in the font file.

The Segoe MDL2 Assets font ships with Windows 10, and new glyphs might be added in every release. You should verify that the Unicode value you choose is available in the minimum SDK build version your project targets.

NavigationViewItem also supports xref:Microsoft.UI.Xaml.Controls.AnimatedIcon. If you set an AnimatedIcon as the value of the Icon property, the NavigationViewItem will set the states of the AnimatedIcon for you, according to the states of the control.

The NavigationViewItem will automatically set the following states on the AnimatedIcon:

  • Normal
  • PointerOver
  • Pressed
  • Selected
  • PressedSelected
  • PointerOverSelected

-see-also

-examples

-xaml-syntax

<NavigationViewItem Icon="symbolName" .../>


<NavigationViewItem>
  <NavigationViewItem.Icon>
    iconElement
  </NavigationViewItem.Icon>
</NavigationViewItem>

-xaml-values

symbolName
symbolNameA named constant of the Symbol enumeration.
iconElement
iconElementA single object element that derives from IconElement and describes the graphic content of the button. The object element is typically one of these classes: SymbolIcon, FontIcon, or PathIcon.