Category / Section
How to restrict level selection in the HierarchyNavigator control?
1 min read
How to restrict level selection in the HierarchyNavigator control?
HierarchyNavigator allows to restrict the number of levels that can be selected in a navigation path using MaxDrillDown property.
The default value is -1, which allows all the levels to be shown
XAML
<syncfusion:HierarchyNavigator MaxDrillDownLevel="2" x:Name="navigator" HorizontalAlignment="Center" VerticalAlignment="Center" Width="350" > <syncfusion:HierarchyNavigator.Items> <syncfusion:HierarchyNavigatorItem Content="Syncfusion" > <syncfusion:HierarchyNavigatorItem.Items> <syncfusion:HierarchyNavigatorItem Content="Silverlight"> <syncfusion:HierarchyNavigatorItem.Items> <syncfusion:HierarchyNavigatorItem Content="Tools"> <syncfusion:HierarchyNavigatorItem.Items> <syncfusion:HierarchyNavigatorItem Content="AutoComplete"/> <syncfusion:HierarchyNavigatorItem Content="BusyIndicator"/> <syncfusion:HierarchyNavigatorItem Content="Carousel"/> </syncfusion:HierarchyNavigatorItem.Items> </syncfusion:HierarchyNavigatorItem> <syncfusion:HierarchyNavigatorItem Content="Grid"/> <syncfusion:HierarchyNavigatorItem Content="Chart"/> <syncfusion:HierarchyNavigatorItem Content="Gauge"/> <syncfusion:HierarchyNavigatorItem Content="Edit"/> <syncfusion:HierarchyNavigatorItem Content="Schedule"/> </syncfusion:HierarchyNavigatorItem.Items> </syncfusion:HierarchyNavigatorItem> <syncfusion:HierarchyNavigatorItem Content="WPF"/> </syncfusion:HierarchyNavigatorItem.Items> </syncfusion:HierarchyNavigatorItem> </syncfusion:HierarchyNavigator.Items> </syncfusion:HierarchyNavigator>
C#
navigator.MaxDrillDownLevel = 2;
As we have set the DrillDownLevel as two in the above code, only two levels gets displayed in the below screenshot