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

How to change content?

2 Answers 583 Views
NavigationView (Hamburger Menu)
This is a migrated thread and some comments may be shown as answers.
Martin
Top achievements
Rank 1
Veteran
Martin asked on 06 Jun 2020, 02:30 AM

Very simple question. How do I statically change content? I figured something like this example:

 

01.<telerik:RadNavigationView HorizontalAlignment="Stretch" PaneHeader="Header" VerticalAlignment="Stretch">
02.            <telerik:RadNavigationView.Items>
03.                <telerik:RadNavigationViewItem Content="Navigation item 1">
04.                    <StackPanel>
05.                        <Label Content="Test 1"/>
06.                    </StackPanel>
07.                </telerik:RadNavigationViewItem>
08.                <telerik:RadNavigationViewItem Content="Navigation item 2">
09.                    <StackPanel>
10.                        <Label Content="Test 2"/>
11.                    </StackPanel>
12.                </telerik:RadNavigationViewItem>
13.                <telerik:RadNavigationViewItem Content="Navigation item 3">
14.                    <StackPanel>
15.                        <Label Content="Test 3"/>
16.                    </StackPanel>
17.                </telerik:RadNavigationViewItem>
18.            </telerik:RadNavigationView.Items>
19.        </telerik:RadNavigationView>

 

But it doesn't work, saying that content is set multiple times.


2 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 10 Jun 2020, 02:51 PM

Hello Martin,

The Content property of RadNavigationViewItem defines what is shown in the item located in the left side menu. Also, there is an error because setting direct content (like the StackPanel in your case) of RadNavigationViewItem is setting its Content property. So, there is a duplication of the Content setting. Use only direct content or the Content property.

If you want to change the content of the RadNavigationView control, you can set its Content property. And if you want to change this when you click on a RadNavigationViewItem, you can use the SelectionChanged event of the SelectedItem property of RadNavigationView. The DataBinding article shows how to utilize the SelectedItem property.

Regards,
Martin Ivanov
Progress Telerik

Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
Our thoughts here at Progress are with those affected by the outbreak.
0
Martin
Top achievements
Rank 1
Veteran
answered on 10 Jun 2020, 02:57 PM
Thanks :)
Tags
NavigationView (Hamburger Menu)
Asked by
Martin
Top achievements
Rank 1
Veteran
Answers by
Martin Ivanov
Telerik team
Martin
Top achievements
Rank 1
Veteran
Share this question
or