New to Telerik UI for WPF? Download free 30-day trial

Remove Indenting From IconTemplate in RadNavigationView

Environment

Product Version 2023.2.718
Product RadNavigationView for WPF

Description

How to remove indenting from IconTemplate of the RadNavigationView element.

Solution 1

  1. Extract the ControlTemplate of RadNavigationViewItem.

  2. In the ControlTemplate find the Grid panel with x:Name set to "ItemContentGrid" and change the Width of the first ColumnDefinition.

  3. Apply the modified template to the RadNavigationViewItem elements.

Solution 2

Use the ChildrenOfType extension method to get the Grid panel with x:Name set to "ItemContentGrid" and change the Width of the first ColumnDefinition .

private void RadNavigationViewItem_Loaded(object sender, RoutedEventArgs e) 
{ 
    var itemContainer = (RadNavigationViewItem)sender; 
    var panel = itemContainer.ChildrenOfType<Grid>().FirstOrDefault(x => x.Name == "ItemContentGrid"); 
    panel.ColumnDefinitions[0].Width = new GridLength(0); 
} 
In this article