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

Display User control in content part of navigationview

3 Answers 952 Views
NavigationView (Hamburger Menu)
This is a migrated thread and some comments may be shown as answers.
Vidhya
Top achievements
Rank 1
Vidhya asked on 12 Oct 2019, 10:34 AM

Hi Sir,

 

i am working with Navigationview.in this , i have to show different page while clicking menus.for that i created usercontrol.and stored usercontol page name in database.now how to bind that name in content.can user id for reference.give solution sir.

3 Answers, 1 is accepted

Sort by
0
Martin Ivanov
Telerik team
answered on 15 Oct 2019, 12:54 PM

Hello Vidhya,

To achieve your requirement, you can use the SelectionChanged event of RadNavigationView. Each time you select a RadNavigationViewItem, the event fires and in the event handler you can get the UserControl that should be displayed and assign it to the Content property of RadNavigationView.

Similar approach, but with data binding to the SelectedItem of RadNavigationView is shown in the First Look demo of the control.

Can you try those suggestions and let me know how it goes?

Regards,
Martin Ivanov
Progress Telerik

Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
Nilesh
Top achievements
Rank 1
Veteran
answered on 25 Sep 2020, 08:41 AM

Hello Martin,

Can you please give us some example to do this using selected item with content region of PRSIM in MVVM pattern. The example you pointed out is very basic example and we want to navigate to different view in content region each time menu is clicked using MVVM pattern.
Kindly help as we are also struck in this from few days.

2
Martin Ivanov
Telerik team
answered on 29 Sep 2020, 02:38 PM

Hello Vidhya,

We do not have a PRISM example, but whatever framework do you use, the basic idea will be the same - when the SelectedItem of RadNavigationView changes, its Content should get updated. The means of listening for selection change are the SelectionChanged event and the SelectedItem setter if using MVVM. And changing the content is done via the Content property of RadNavigationView. The exact approach how those will be used is up to the concrete application requirements or third party framework specifics (like in PRISM). 

Anyway, I've created a small example using Prism and RadNavigationView. I hope this helps.

Regards,
Martin Ivanov
Progress Telerik

Five days of Blazor, Angular, React, and Xamarin experts live-coding on twitch.tv/CodeItLive, special prizes, and more, for FREE?! Register now for DevReach 2.0(20).

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