This is a migrated thread and some comments may be shown as answers.

Missing Icon for Child Items

1 Answer 130 Views
NavigationView (Hamburger Menu)
This is a migrated thread and some comments may be shown as answers.
Federico Gubellini
Top achievements
Rank 1
Federico Gubellini asked on 05 Nov 2020, 02:07 PM

Hi all,

Is it possible to display icons for child items of a navigation view in a data-bound hierarchy scenario? I'm following the documentation at https://docs.telerik.com/devtools/wpf/controls/radnavigationview/populating-with-data/hierarchical-databinding but also in this example the icons are missing for child items (even if them are defined in the example data model).

Thanks.

1 Answer, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 09 Nov 2020, 08:36 PM

Hello Federico,

The ItemContainerStyle of RadNavigationView is applied only to the root level of the items. The documentation is not complete on the topic so we will update it accordingly. You can also find your Telerik points updated. 

To achieve your requirement, you can use an implicit style defined in the Window Resources collection, instead of the ItemContainerStyle. For example:

<Window.Resources>
	<telerik:StringToGlyphConverter x:Key="StringToGlyphConverter" />
	<Style TargetType="telerik:RadNavigationViewItem">
		<Setter Property="ItemsSource" Value="{Binding Children}" />
		<Setter Property="DisplayMemberPath" Value="Title" />
		<Setter Property="Icon" Value="{Binding IconGlyph}" />
		<Setter Property="IconTemplate">
			<Setter.Value>
				<DataTemplate>
					<telerik:RadGlyph Glyph="{Binding Converter={StaticResource StringToGlyphConverter}}" />
				</DataTemplate>
			</Setter.Value>
		</Setter>
	</Style>
</Window.Resources>

See also the attached project. I hope this helps.

Regards,
Martin Ivanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
NavigationView (Hamburger Menu)
Asked by
Federico Gubellini
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Share this question
or