Back to Devexpress

Expanding and Collapsing Navigation Panes

vcl-160038-expressnavbar-concepts-views-expanding-and-collapsing-navigation-panes.md

latest2.6 KB
Original Source

Expanding and Collapsing Navigation Panes

  • Dec 28, 2020

When a Navigation Pane View is applied to the NavBar control, the entire control can be collapsed, and then expanded to restore its size. Refer to the Collapsed Navigation Pane help topic to learn more about the collapsed state.

|

Expanded

State

|

Collapsed

State

| | --- | --- | |

|

|

In code, the expanded state can be changed via the control’s OptionsBehavior.NavigationPane.Collapsed property. End-users can accomplish this by clicking a double arrow displayed in the Navigation Pane’s header section, if the OptionsBehavior.NavigationPane.Collapsible property is enabled.

You can respond to changes made to the Navigation Pane’s expanded state by handling the OnNavigationPaneCollapsed and OnNavigationPaneExpanded events. The example code below demonstrates how to handle these events to modify the overflow panel‘s visibility, and activate a certain group based on the Navigation Pane’s expanded state.

delphi
procedure TForm1.nbMainNavigationPaneCollapsed(Sender: TObject);
begin
  nbMain.OptionsView.NavigationPane.ShowOverflowPanel := False;
  nbMain.ActiveGroup := bgContacts;
end;
procedure TForm1.nbMainNavigationPaneExpanded(Sender: TObject);
begin
  nbMain.OptionsView.NavigationPane.ShowOverflowPanel := True;
  nbMain.ActiveGroup := bgMail;
end;
cpp
void __fastcall TForm1::nbMainNavigationPaneCollapsed(TObject *Sender)
{
  nbMain->OptionsView->NavigationPane->ShowOverflowPanel = false;
  nbMain->ActiveGroup = bgContacts;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::nbMainNavigationPaneExpanded(TObject *Sender)
{
  nbMain->OptionsView->NavigationPane->ShowOverflowPanel = true;
  nbMain->ActiveGroup = bgMail;
}