$99 VS $1000+. UI Control for ASP.NET AJAX(contains chart and gridview).
How to Put up Item Expanding and Collapsing of NavigationBar Using C#
Home > How to > NavigationBar Expanding and Collapsing Items

KT.UI PerNavigationBar component collection is dedicated to offering users the complete server side supports for PerNavigationBar expanding and collapsing with perfect visualizing effect within ASP.NET programming project.
In this page, we are going to talk about following aspects of PerNavigationBar controls within ASP.NET application:
  • How to set ExpandMode by using offered sample C# codes
  • How to set and define AllowCollapseAllItems by using available demo C# codes
  • How to set AllowCollapseAllItems animation with C# sample codes

How to Set ExpandMode with C# Demo Codes

ExpandMode Introdutions

ExpandMode property of PerNavigationBar components affect on the way the navigation bar responds when users click and select navigation items that have child items. And, ExpandMode has three supportable settings: MultipleExpandedItems (which is the default choice for expanding), SingleExpandedItem and FullExpandedItem.
  • MultipleExpandedItems - When users set ExpandMode as "MultipleExpandedItems", you can expand more than one item at the same time. And the navigation bar displays the value of its overall height of all the level items of root items.
  • SingleExpandedItem - When users choose ExpandMode as "SingleExpandedItem", the navigation bar shows the one selected item at a time. The height of the navigation bar is the overall height of the level items of the selected root item.
  • FullExpandedItem - When users define ExpandMode as "FullExpandedItem", only one item can be expanded at a time just like "SingleExpandedItem" mentioned above. And in this expanding mode, the height of navigation bar is always decided and specified by its Height property.

C# Demo Codes for Setting ExpandMode

PerNavigationBar1.ExpandMode = NavigationBarExpandMode.MultipleExpandedItems;

How to Set AllowCollapseAllItems with C# Demo Codes

When users set the AllowCollapseAllItems property as True, you can collapse all the expanded items, no matter the the ExpandMode is set as SingleExpanded Item or FullExpandedItem.

PerNavigationBar1.AllowCollapseAllItems = true;

How to Set Animation with C# Demo Codes

When users expand and collapse navigation bar with the support of KT.UI PerNavigationItem control, animation object can be added and defined. The animation property of PerNavigationItem consists of ExpandAnimation and CollapseAnimation. And the animation can be specified by setting attributes: Type and Duration, by which users can set the animation effect and displaying time when collapse navigation bar.

PerNavigationBar1.ExpandAnimation.Duration = 500;
PerNavigationBar1.ExpandAnimation.Type = AnimationType.InCubic;
PerNavigationBar1.CollapseAnimation.Duration = 500;
PerNavigationBar1.CollapseAnimation.Type = AnimationType.OutQuint;