NavigationView
struct · ferroui-controls · v0.5.0
struct NavigationView
A navigation pane with menu items and a content area (WinUI's NavigationView).
The pane is at the left (Left, LeftCompact, LeftMinimal, or chosen by the width in Auto:
the display modes Expanded, Compact and Minimal) or at the top (Top). The template of the
WinUI theme is WinUI's (NavigationView.xaml): the control finds WinUI's parts (RootSplitView,
TogglePaneButton, NavigationViewBackButton, NavigationViewCloseButton,
PaneAutoSuggestButton, PaneTitleTextBlock, PaneTitleHolder, PaneTitlePresenter,
PaneTitleOnTopPane, MenuItemsHost, FooterMenuItemsHost, TopNavMenuItemsHost,
TopFooterMenuItemsHost, the content controls of the pane header, custom content, footer and auto
suggest box of the left and the top pane, ContentLeftPadding), sets their contents and the
values of template_settings as WinUI's code does, and sets WinUI's
visual states as pseudo-classes (:compact, :expanded, :minimal, :top-navigation-minimal,
:minimal-with-back-button, :toggle-pane-button-visible, :header-collapsed,
:auto-suggest-box-collapsed, :closed-compact, :list-size-compact, :pane-not-overlaying,
:back-button-collapsed, :pane-collapsed, and :back-button-row-visible for the row WinUI
sizes in code). The Fluent and Simple themes have no template.
The menu items are realized in stack panels, not in ItemsRepeaters with a hierarchical
SelectionModel (follow-up F1). Missing (docs/porting/winui-controls.md, section 10.4): the
overflow of the top pane, the animations of the pane, the
shadow of the pane, the padding of the title bar, the shoulder navigation and the selectors of
templates and styles.
Members
TYPEto_refis_pane_open_propertycompact_mode_threshold_width_propertyexpanded_mode_threshold_width_propertyis_settings_visible_propertyis_pane_toggle_button_visible_propertyalways_show_header_propertycompact_pane_length_propertyopen_pane_length_propertyis_pane_visible_propertyis_back_enabled_propertyis_back_button_visible_propertypane_display_mode_propertyselection_follows_focus_propertypane_title_propertyheader_propertyheader_template_propertyselected_item_propertypane_header_propertypane_footer_propertypane_custom_content_propertycontent_overlay_propertyauto_suggest_box_propertymenu_items_source_propertyfooter_menu_items_source_propertymenu_item_template_propertypane_toggle_button_style_propertymenu_item_container_style_propertymenu_items_propertyfooter_menu_items_propertysettings_item_propertydisplay_mode_propertytemplate_settings_propertyconstructnewmenu_itemsfooter_menu_itemssettings_itemtemplate_settingsdisplay_modeis_pane_openset_is_pane_opencompact_mode_threshold_widthset_compact_mode_threshold_widthexpanded_mode_threshold_widthset_expanded_mode_threshold_widthis_settings_visibleset_is_settings_visibleis_pane_toggle_button_visibleset_is_pane_toggle_button_visiblealways_show_headerset_always_show_headercompact_pane_lengthset_compact_pane_lengthopen_pane_lengthset_open_pane_lengthis_pane_visibleset_is_pane_visibleis_back_enabledset_is_back_enabledis_back_button_visibleset_is_back_button_visiblepane_display_modeset_pane_display_modeselection_follows_focusset_selection_follows_focuspane_titleset_pane_titleheaderset_headerheader_templateset_header_templateselected_itemset_selected_itempane_headerset_pane_headerpane_footerset_pane_footerpane_custom_contentset_pane_custom_contentcontent_overlayset_content_overlayauto_suggest_boxset_auto_suggest_boxmenu_items_sourceset_menu_items_sourcefooter_menu_items_sourceset_footer_menu_items_sourcemenu_item_templateset_menu_item_templatepane_toggle_button_styleset_pane_toggle_button_stylemenu_item_container_styleset_menu_item_container_styleselection_changeditem_invokeddisplay_mode_changedback_requestedpane_closingexpandingcollapsedpane_openingpane_openedpane_closedcontainer_from_menu_itemmenu_item_from_containerexpandcollapse
TYPE
const TYPE: &'static $crate::TypeInfo
The runtime type of this class.
to_ref
fn to_ref(self: &Self) -> $crate::Ref<NavigationView>
Returns a strong reference to this object.
is_pane_open_property
fn is_pane_open_property() -> &'static StyledProperty<bool>
Defines the IsPaneOpen property: whether the pane is open. true by default.
compact_mode_threshold_width_property
fn compact_mode_threshold_width_property() -> &'static StyledProperty<f64>
Defines the CompactModeThresholdWidth property: the width from which the display mode of
Auto is Compact. 641 by default.
expanded_mode_threshold_width_property
fn expanded_mode_threshold_width_property() -> &'static StyledProperty<f64>
Defines the ExpandedModeThresholdWidth property: the width from which the display mode of
Auto is Expanded. 1008 by default.
is_settings_visible_property
fn is_settings_visible_property() -> &'static StyledProperty<bool>
Defines the IsSettingsVisible property: whether the settings item is shown. true by
default.
is_pane_toggle_button_visible_property
fn is_pane_toggle_button_visible_property() -> &'static StyledProperty<bool>
Defines the IsPaneToggleButtonVisible property. true by default.
always_show_header_property
fn always_show_header_property() -> &'static StyledProperty<bool>
Defines the AlwaysShowHeader property. true by default.
compact_pane_length_property
fn compact_pane_length_property() -> &'static StyledProperty<f64>
Defines the CompactPaneLength property: the width of the closed compact pane. 48 by
default; the WinUI theme sets NavigationViewCompactPaneLength.
open_pane_length_property
fn open_pane_length_property() -> &'static StyledProperty<f64>
Defines the OpenPaneLength property: the width of the open pane. 320 by default.
is_pane_visible_property
fn is_pane_visible_property() -> &'static StyledProperty<bool>
Defines the IsPaneVisible property: whether the pane is shown at all. true by default.
is_back_enabled_property
fn is_back_enabled_property() -> &'static StyledProperty<bool>
Defines the IsBackEnabled property: whether the back button is enabled.
is_back_button_visible_property
fn is_back_button_visible_property() -> &'static StyledProperty<NavigationViewBackButtonVisible>
Defines the IsBackButtonVisible property. Auto by default.
pane_display_mode_property
fn pane_display_mode_property() -> &'static StyledProperty<NavigationViewPaneDisplayMode>
Defines the PaneDisplayMode property. Auto by default.
selection_follows_focus_property
fn selection_follows_focus_property() -> &'static StyledProperty<NavigationViewSelectionFollowsFocus>
Defines the SelectionFollowsFocus property. Disabled by default.
pane_title_property
fn pane_title_property() -> &'static StyledProperty<String>
Defines the PaneTitle property: the title of the pane.
header_property
fn header_property() -> &'static StyledProperty<Option<BoxedValue>>
Defines the Header property: the header above the content.
header_template_property
fn header_template_property() -> &'static StyledProperty<Option<Rc<dyn IDataTemplate>>>
Defines the HeaderTemplate property.
selected_item_property
fn selected_item_property() -> &'static StyledProperty<Option<BoxedValue>>
Defines the SelectedItem property: the selected menu item (the data item or the
container).
pane_header_property
fn pane_header_property() -> &'static StyledProperty<Option<Ref<Control>>>
Defines the PaneHeader property.
pane_footer_property
fn pane_footer_property() -> &'static StyledProperty<Option<Ref<Control>>>
Defines the PaneFooter property.
pane_custom_content_property
fn pane_custom_content_property() -> &'static StyledProperty<Option<Ref<Control>>>
Defines the PaneCustomContent property.
content_overlay_property
fn content_overlay_property() -> &'static StyledProperty<Option<Ref<Control>>>
Defines the ContentOverlay property: content shown under the top pane.
auto_suggest_box_property
fn auto_suggest_box_property() -> &'static StyledProperty<Option<Ref<AutoSuggestBox>>>
Defines the AutoSuggestBox property: the search box of the pane.
menu_items_source_property
fn menu_items_source_property() -> &'static StyledProperty<Option<ItemsSource>>
Defines the MenuItemsSource property.
footer_menu_items_source_property
fn footer_menu_items_source_property() -> &'static StyledProperty<Option<ItemsSource>>
Defines the FooterMenuItemsSource property.
menu_item_template_property
fn menu_item_template_property() -> &'static StyledProperty<Option<Rc<dyn IDataTemplate>>>
Defines the MenuItemTemplate property: the template of the data items.
pane_toggle_button_style_property
fn pane_toggle_button_style_property() -> &'static StyledProperty<Option<Ref<ControlTheme>>>
Defines the PaneToggleButtonStyle property: the control theme of the pane toggle button
(WinUI's style; the WinUI theme sets PaneToggleButtonStyle).
menu_item_container_style_property
fn menu_item_container_style_property() -> &'static StyledProperty<Option<Ref<ControlTheme>>>
Defines the MenuItemContainerStyle property: the control theme of the containers.
menu_items_property
fn menu_items_property() -> &'static DirectProperty<NavigationView, ItemCollection>
Defines the MenuItems property (read-only; the collection is writable).
footer_menu_items_property
fn footer_menu_items_property() -> &'static DirectProperty<NavigationView, ItemCollection>
Defines the FooterMenuItems property (read-only; the collection is writable).
settings_item_property
fn settings_item_property() -> &'static DirectProperty<NavigationView, Option<BoxedValue>>
Defines the SettingsItem property: the settings item (read-only).
display_mode_property
fn display_mode_property() -> &'static DirectProperty<NavigationView, NavigationViewDisplayMode>
Defines the DisplayMode property: the display mode (read-only).
template_settings_property
fn template_settings_property() -> &'static DirectProperty<NavigationView, Ref<NavigationViewTemplateSettings>>
Defines the TemplateSettings property: the values the template binds to (read-only).
construct
fn construct() -> Self
Creates the class data; see ferroui_base::FerroObject::construct.
new
fn new() -> Ref<Self>
Creates a navigation view.
menu_items
fn menu_items(self: &Self) -> ItemCollection
Gets the menu items (writable, also while MenuItemsSource is set).
footer_menu_items
fn footer_menu_items(self: &Self) -> ItemCollection
Gets the footer menu items (writable, also while FooterMenuItemsSource is set).
settings_item
fn settings_item(self: &Self) -> Ref<NavigationViewItem>
Gets the settings item.
template_settings
fn template_settings(self: &Self) -> Ref<NavigationViewTemplateSettings>
Gets the values the template binds to.
display_mode
fn display_mode(self: &Self) -> NavigationViewDisplayMode
Gets the display mode.
is_pane_open
fn is_pane_open(self: &Self) -> bool
set_is_pane_open
fn set_is_pane_open(self: &Self, value: bool)
compact_mode_threshold_width
fn compact_mode_threshold_width(self: &Self) -> f64
set_compact_mode_threshold_width
fn set_compact_mode_threshold_width(self: &Self, value: f64)
expanded_mode_threshold_width
fn expanded_mode_threshold_width(self: &Self) -> f64
set_expanded_mode_threshold_width
fn set_expanded_mode_threshold_width(self: &Self, value: f64)
is_settings_visible
fn is_settings_visible(self: &Self) -> bool
set_is_settings_visible
fn set_is_settings_visible(self: &Self, value: bool)
is_pane_toggle_button_visible
fn is_pane_toggle_button_visible(self: &Self) -> bool
set_is_pane_toggle_button_visible
fn set_is_pane_toggle_button_visible(self: &Self, value: bool)
always_show_header
fn always_show_header(self: &Self) -> bool
set_always_show_header
fn set_always_show_header(self: &Self, value: bool)
compact_pane_length
fn compact_pane_length(self: &Self) -> f64
set_compact_pane_length
fn set_compact_pane_length(self: &Self, value: f64)
open_pane_length
fn open_pane_length(self: &Self) -> f64
set_open_pane_length
fn set_open_pane_length(self: &Self, value: f64)
is_pane_visible
fn is_pane_visible(self: &Self) -> bool
set_is_pane_visible
fn set_is_pane_visible(self: &Self, value: bool)
is_back_enabled
fn is_back_enabled(self: &Self) -> bool
set_is_back_enabled
fn set_is_back_enabled(self: &Self, value: bool)
is_back_button_visible
fn is_back_button_visible(self: &Self) -> NavigationViewBackButtonVisible
set_is_back_button_visible
fn set_is_back_button_visible(self: &Self, value: NavigationViewBackButtonVisible)
pane_display_mode
fn pane_display_mode(self: &Self) -> NavigationViewPaneDisplayMode
set_pane_display_mode
fn set_pane_display_mode(self: &Self, value: NavigationViewPaneDisplayMode)
selection_follows_focus
fn selection_follows_focus(self: &Self) -> NavigationViewSelectionFollowsFocus
set_selection_follows_focus
fn set_selection_follows_focus(self: &Self, value: NavigationViewSelectionFollowsFocus)
pane_title
fn pane_title(self: &Self) -> String
set_pane_title
fn set_pane_title(self: &Self, value: String)
header
fn header(self: &Self) -> Option<BoxedValue>
set_header
fn set_header(self: &Self, value: Option<BoxedValue>)
header_template
fn header_template(self: &Self) -> Option<Rc<dyn IDataTemplate>>
set_header_template
fn set_header_template(self: &Self, value: Option<Rc<dyn IDataTemplate>>)
selected_item
fn selected_item(self: &Self) -> Option<BoxedValue>
set_selected_item
fn set_selected_item(self: &Self, value: Option<BoxedValue>)
pane_header
fn pane_header(self: &Self) -> Option<Ref<Control>>
set_pane_header
fn set_pane_header(self: &Self, value: Option<Ref<Control>>)
pane_footer
fn pane_footer(self: &Self) -> Option<Ref<Control>>
set_pane_footer
fn set_pane_footer(self: &Self, value: Option<Ref<Control>>)
pane_custom_content
fn pane_custom_content(self: &Self) -> Option<Ref<Control>>
set_pane_custom_content
fn set_pane_custom_content(self: &Self, value: Option<Ref<Control>>)
content_overlay
fn content_overlay(self: &Self) -> Option<Ref<Control>>
set_content_overlay
fn set_content_overlay(self: &Self, value: Option<Ref<Control>>)
auto_suggest_box
fn auto_suggest_box(self: &Self) -> Option<Ref<AutoSuggestBox>>
set_auto_suggest_box
fn set_auto_suggest_box(self: &Self, value: Option<Ref<AutoSuggestBox>>)
menu_items_source
fn menu_items_source(self: &Self) -> Option<ItemsSource>
set_menu_items_source
fn set_menu_items_source(self: &Self, value: Option<ItemsSource>)
footer_menu_items_source
fn footer_menu_items_source(self: &Self) -> Option<ItemsSource>
set_footer_menu_items_source
fn set_footer_menu_items_source(self: &Self, value: Option<ItemsSource>)
menu_item_template
fn menu_item_template(self: &Self) -> Option<Rc<dyn IDataTemplate>>
set_menu_item_template
fn set_menu_item_template(self: &Self, value: Option<Rc<dyn IDataTemplate>>)
pane_toggle_button_style
fn pane_toggle_button_style(self: &Self) -> Option<Ref<ControlTheme>>
set_pane_toggle_button_style
fn set_pane_toggle_button_style(self: &Self, value: Option<Ref<ControlTheme>>)
menu_item_container_style
fn menu_item_container_style(self: &Self) -> Option<Ref<ControlTheme>>
set_menu_item_container_style
fn set_menu_item_container_style(self: &Self, value: Option<Ref<ControlTheme>>)
selection_changed
fn selection_changed(self: &Self, handler: impl Fn(&NavigationViewSelectionChangedEventArgs) -> () + 'static) -> Subscription
Adds a handler of SelectionChanged. Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the view.
item_invoked
fn item_invoked(self: &Self, handler: impl Fn(&NavigationViewItemInvokedEventArgs) -> () + 'static) -> Subscription
Adds a handler of ItemInvoked. Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the view.
display_mode_changed
fn display_mode_changed(self: &Self, handler: impl Fn(&NavigationViewDisplayModeChangedEventArgs) -> () + 'static) -> Subscription
Adds a handler of DisplayModeChanged. Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the view.
back_requested
fn back_requested(self: &Self, handler: impl Fn(&NavigationViewBackRequestedEventArgs) -> () + 'static) -> Subscription
Adds a handler of BackRequested. Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the view.
pane_closing
fn pane_closing(self: &Self, handler: impl Fn(&NavigationViewPaneClosingEventArgs) -> () + 'static) -> Subscription
Adds a handler of PaneClosing. Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the view.
expanding
fn expanding(self: &Self, handler: impl Fn(&NavigationViewItemExpandingEventArgs) -> () + 'static) -> Subscription
Adds a handler of Expanding. Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the view.
collapsed
fn collapsed(self: &Self, handler: impl Fn(&NavigationViewItemCollapsedEventArgs) -> () + 'static) -> Subscription
Adds a handler of Collapsed. Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the view.
pane_opening
fn pane_opening(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Adds a handler of PaneOpening. Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the view.
pane_opened
fn pane_opened(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Adds a handler of PaneOpened. Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the view.
pane_closed
fn pane_closed(self: &Self, handler: impl Fn() -> () + 'static) -> Subscription
Adds a handler of PaneClosed. Dropping the returned guard removes the handler;
Subscription::detach keeps it for the life of the view.
container_from_menu_item
fn container_from_menu_item(self: &Self, item: &Option<BoxedValue>) -> Option<Ref<NavigationViewItemBase>>
Gets the realized container of a menu item, a footer item or a nested item
(ContainerFromMenuItem).
menu_item_from_container
fn menu_item_from_container(self: &Self, container: &FerroObject) -> Option<BoxedValue>
Gets the menu item of a container (MenuItemFromContainer).
expand
fn expand(self: &Self, item: &NavigationViewItem)
Expands an item that has children (Expand).
collapse
fn collapse(self: &Self, item: &NavigationViewItem)
Collapses an item that has children (Collapse).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafeTemplatedControlImplExtContentControlImplExtControlImplExtBorrow<T>BorrowMut<T>Into<U>From<T>TryInto<U>TryFrom<U>ReceiverAnyInputElementImplExtInteractiveImplExtLayoutableImplExtFerroObjectImplExtStyledElementImplExtClassDefaultsVisualImplExtErasedDestructorIntoEitherDerefUpcast<T>Upcast<NavigationView>StaticTypeObjectTypeSubclassable<T>DefaultConstructibleStyledElementImplInteractiveImplContentControlImplFerroObjectImplControlImplLayoutableImplInputElementImplTemplatedControlImplDropVisualImpl
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.