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
Extract the ControlTemplate of
RadNavigationViewItem
.In the
ControlTemplate
find theGrid
panel withx:Name
set to "ItemContentGrid" and change theWidth
of the firstColumnDefinition
.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);
}