# NavigationViewItem

Version: 0.5.0
Framework commit: d503df2befa756e681fcdc6250e9552dc7388bea
Canonical URL: /docs/0.5.0/api/ferroui-controls/struct-navigationviewitem/

**struct** · [`ferroui-controls`](/docs/0.5.0/api/ferroui-controls/) · v0.5.0

```rust
struct NavigationViewItem
```

A selectable item of a `NavigationView`, with an icon, an info badge
and child items (WinUI's `NavigationViewItem`).

The template of the WinUI theme draws the item as WinUI's item presenter does
(`NavigationViewItemPresenter` and its styles for the left and the top pane, folded into the
template of the item). The item sets the states of WinUI as pseudo-classes: `:selected`,
`:pressed`, `:on-top-navigation-primary`, `:icon-collapsed`, `:icon-only`, `:content-only`,
`:info-badge-collapsed`, `:chevron-visible-open`, `:chevron-visible-closed` and
`:closed-compact-and-top-level-item`. The child items are hosted in the template part
`NavigationViewItemMenuItemsHost`, below the item, or in the popup `ChildrenFlyout` when the item
is in the top pane or at the top level of a closed compact pane, as WinUI moves its repeater into
its flyout. The Fluent and Simple themes have no template.

The children are realized in a stack panel, not an `ItemsRepeater` (follow-up F1); the
containers of data items are reused across edits of the collections.

[View source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L174)

## Members

- [`TYPE`](#assoc_const-type)
- [`to_ref`](#function-to_ref)
- [`icon_property`](#function-icon_property)
- [`info_badge_property`](#function-info_badge_property)
- [`compact_pane_length_property`](#function-compact_pane_length_property)
- [`selects_on_invoked_property`](#function-selects_on_invoked_property)
- [`is_expanded_property`](#function-is_expanded_property)
- [`has_unrealized_children_property`](#function-has_unrealized_children_property)
- [`is_child_selected_property`](#function-is_child_selected_property)
- [`menu_items_property`](#function-menu_items_property)
- [`menu_items_source_property`](#function-menu_items_source_property)
- [`construct`](#function-construct)
- [`new`](#function-new)
- [`icon`](#function-icon)
- [`set_icon`](#function-set_icon)
- [`info_badge`](#function-info_badge)
- [`set_info_badge`](#function-set_info_badge)
- [`compact_pane_length`](#function-compact_pane_length)
- [`selects_on_invoked`](#function-selects_on_invoked)
- [`set_selects_on_invoked`](#function-set_selects_on_invoked)
- [`is_expanded`](#function-is_expanded)
- [`set_is_expanded`](#function-set_is_expanded)
- [`has_unrealized_children`](#function-has_unrealized_children)
- [`set_has_unrealized_children`](#function-set_has_unrealized_children)
- [`is_child_selected`](#function-is_child_selected)
- [`set_is_child_selected`](#function-set_is_child_selected)
- [`menu_items`](#function-menu_items)
- [`menu_items_source`](#function-menu_items_source)
- [`set_menu_items_source`](#function-set_menu_items_source)

<a id="assoc_const-type"></a>

### TYPE

```rust
const TYPE: &'static $crate::TypeInfo
```

The runtime type of this class.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L203)

<a id="function-to_ref"></a>

### to_ref

```rust
fn to_ref(self: &Self) -> $crate::Ref<NavigationViewItem>
```

Returns a strong reference to this object.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L203)

<a id="function-icon_property"></a>

### icon_property

```rust
fn icon_property() -> &'static StyledProperty<Option<Ref<IconElement>>>
```

Defines the `Icon` property: the icon of the item.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L450)

<a id="function-info_badge_property"></a>

### info_badge_property

```rust
fn info_badge_property() -> &'static StyledProperty<Option<Ref<InfoBadge>>>
```

Defines the `InfoBadge` property: the badge shown beside the content of the item.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L450)

<a id="function-compact_pane_length_property"></a>

### compact_pane_length_property

```rust
fn compact_pane_length_property() -> &'static DirectProperty<NavigationViewItem, f64>
```

Defines the `CompactPaneLength` property: the compact pane length of the navigation view
(read-only).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L450)

<a id="function-selects_on_invoked_property"></a>

### selects_on_invoked_property

```rust
fn selects_on_invoked_property() -> &'static StyledProperty<bool>
```

Defines the `SelectsOnInvoked` property: whether invoking the item selects it. `true` by
default.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L450)

<a id="function-is_expanded_property"></a>

### is_expanded_property

```rust
fn is_expanded_property() -> &'static StyledProperty<bool>
```

Defines the `IsExpanded` property: whether the child items are shown.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L450)

<a id="function-has_unrealized_children_property"></a>

### has_unrealized_children_property

```rust
fn has_unrealized_children_property() -> &'static StyledProperty<bool>
```

Defines the `HasUnrealizedChildren` property: whether the item has children that the
application adds when it expands.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L450)

<a id="function-is_child_selected_property"></a>

### is_child_selected_property

```rust
fn is_child_selected_property() -> &'static StyledProperty<bool>
```

Defines the `IsChildSelected` property: whether a descendant item is selected.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L450)

<a id="function-menu_items_property"></a>

### menu_items_property

```rust
fn menu_items_property() -> &'static DirectProperty<NavigationViewItem, ItemCollection>
```

Defines the `MenuItems` property: the child items (read-only; the collection is writable).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L450)

<a id="function-menu_items_source_property"></a>

### menu_items_source_property

```rust
fn menu_items_source_property() -> &'static StyledProperty<Option<ItemsSource>>
```

Defines the `MenuItemsSource` property: the source of the child items, which takes
precedence over `MenuItems` while it is set.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L450)

<a id="function-construct"></a>

### construct

```rust
fn construct() -> Self
```

Creates the class data; see `ferroui_base::FerroObject::construct`.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L509)

<a id="function-new"></a>

### new

```rust
fn new() -> Ref<Self>
```

Creates an item.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L541)

<a id="function-icon"></a>

### icon

```rust
fn icon(self: &Self) -> Option<Ref<IconElement>>
```

Gets the icon.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L546)

<a id="function-set_icon"></a>

### set_icon

```rust
fn set_icon(self: &Self, value: Option<Ref<IconElement>>)
```

Sets the icon.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L551)

<a id="function-info_badge"></a>

### info_badge

```rust
fn info_badge(self: &Self) -> Option<Ref<InfoBadge>>
```

Gets the info badge.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L556)

<a id="function-set_info_badge"></a>

### set_info_badge

```rust
fn set_info_badge(self: &Self, value: Option<Ref<InfoBadge>>)
```

Sets the info badge.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L561)

<a id="function-compact_pane_length"></a>

### compact_pane_length

```rust
fn compact_pane_length(self: &Self) -> f64
```

Gets the compact pane length of the navigation view of the item.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L566)

<a id="function-selects_on_invoked"></a>

### selects_on_invoked

```rust
fn selects_on_invoked(self: &Self) -> bool
```

Gets whether invoking the item selects it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L571)

<a id="function-set_selects_on_invoked"></a>

### set_selects_on_invoked

```rust
fn set_selects_on_invoked(self: &Self, value: bool)
```

Sets whether invoking the item selects it.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L576)

<a id="function-is_expanded"></a>

### is_expanded

```rust
fn is_expanded(self: &Self) -> bool
```

Gets whether the child items are shown.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L581)

<a id="function-set_is_expanded"></a>

### set_is_expanded

```rust
fn set_is_expanded(self: &Self, value: bool)
```

Sets whether the child items are shown.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L586)

<a id="function-has_unrealized_children"></a>

### has_unrealized_children

```rust
fn has_unrealized_children(self: &Self) -> bool
```

Gets whether the item has children the application adds when it expands.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L591)

<a id="function-set_has_unrealized_children"></a>

### set_has_unrealized_children

```rust
fn set_has_unrealized_children(self: &Self, value: bool)
```

Sets whether the item has children the application adds when it expands.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L596)

<a id="function-is_child_selected"></a>

### is_child_selected

```rust
fn is_child_selected(self: &Self) -> bool
```

Gets whether a descendant item is selected.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L601)

<a id="function-set_is_child_selected"></a>

### set_is_child_selected

```rust
fn set_is_child_selected(self: &Self, value: bool)
```

Sets whether a descendant item is selected.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L606)

<a id="function-menu_items"></a>

### menu_items

```rust
fn menu_items(self: &Self) -> ItemCollection
```

Gets the child items (writable, also while `MenuItemsSource` is set, as in WinUI).

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L611)

<a id="function-menu_items_source"></a>

### menu_items_source

```rust
fn menu_items_source(self: &Self) -> Option<ItemsSource>
```

Gets the source of the child items.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L616)

<a id="function-set_menu_items_source"></a>

### set_menu_items_source

```rust
fn set_menu_items_source(self: &Self, value: Option<ItemsSource>)
```

Sets the source of the child items.

[Source](https://github.com/wieslawsoltes/FerroUI/blob/d503df2befa756e681fcdc6250e9552dc7388bea/src/FerroUI.Controls/navigation_view_item.rs#L621)

## Trait implementations

- `Send`
- `Sync`
- `Freeze`
- `UnsafeUnpin`
- `Unpin`
- `UnwindSafe`
- `RefUnwindSafe`
- [`TemplatedControlImplExt`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimplext/)
- [`ContentControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-contentcontrolimplext/)
- [`ControlImplExt`](/docs/0.5.0/api/ferroui-controls/trait-controlimplext/)
- `Borrow<T>`
- `BorrowMut<T>`
- `Into<U>`
- `From<T>`
- `TryInto<U>`
- `TryFrom<U>`
- [`Receiver`](/docs/0.5.0/api/ferroui-system/task/oneshot/struct-receiver/)
- `Any`
- [`InputElementImplExt`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimplext/)
- [`InteractiveImplExt`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimplext/)
- [`LayoutableImplExt`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimplext/)
- [`FerroObjectImplExt`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimplext/)
- [`StyledElementImplExt`](/docs/0.5.0/api/ferroui-base/trait-styledelementimplext/)
- [`ClassDefaults`](/docs/0.5.0/api/ferroui-base/trait-classdefaults/)
- [`VisualImplExt`](/docs/0.5.0/api/ferroui-base/trait-visualimplext/)
- `ErasedDestructor`
- `IntoEither`
- `Deref`
- [`Upcast<T>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`Upcast<NavigationViewItem>`](/docs/0.5.0/api/ferroui-base/trait-upcast/)
- [`StaticType`](/docs/0.5.0/api/ferroui-base/trait-statictype/)
- [`ObjectType`](/docs/0.5.0/api/ferroui-base/trait-objecttype/)
- [`Subclassable<T>`](/docs/0.5.0/api/ferroui-base/trait-subclassable/)
- [`DefaultConstructible`](/docs/0.5.0/api/ferroui-base/trait-defaultconstructible/)
- [`StyledElementImpl`](/docs/0.5.0/api/ferroui-base/trait-styledelementimpl/)
- [`InteractiveImpl`](/docs/0.5.0/api/ferroui-base/interactivity/trait-interactiveimpl/)
- [`ContentControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-contentcontrolimpl/)
- [`FerroObjectImpl`](/docs/0.5.0/api/ferroui-base/trait-ferroobjectimpl/)
- [`VisualImpl`](/docs/0.5.0/api/ferroui-base/trait-visualimpl/)
- [`ControlImpl`](/docs/0.5.0/api/ferroui-controls/trait-controlimpl/)
- [`LayoutableImpl`](/docs/0.5.0/api/ferroui-base/layout/trait-layoutableimpl/)
- [`InputElementImpl`](/docs/0.5.0/api/ferroui-base/input/trait-inputelementimpl/)
- [`TemplatedControlImpl`](/docs/0.5.0/api/ferroui-controls/primitives/trait-templatedcontrolimpl/)
- `Drop`

## Availability

Extracted for `aarch64-apple-darwin`. Cargo features are listed in the [crate index](/docs/0.5.0/api/).
