Replies: 3 comments 1 reply
-
@nickrandolph will have some insights there. |
Beta Was this translation helpful? Give feedback.
-
I was able to figure out how to get this working the way I expected. It appears that Navigation with content controls works more like what I was expecting. Part of my confusion was the documentation here: https://platform.uno/docs/articles/external/uno.extensions/doc/Learn/Tutorials/Navigation/Advanced/HowTo-UseContentControl.html didn't include things like the route setup and code behind. I combined that documentation with some of the other advanced navigation documentation and was able to figure out what I was doing wrong. |
Beta Was this translation helpful? Give feedback.
-
can you set regions programmatically using c#? for example: NavigationItems = new List<NavigationViewItem>
{
new NavigationViewItem { Name = "Main", Content = "Main", Icon = new SymbolIcon(Symbol.Home) },
new NavigationViewItem { Name = "Third", Content = "Third", Icon = new SymbolIcon(Symbol.Favorite) },
};
// Assuming these are the region names you want to assign
string[] regionNames = { "Main", "Third" };
// Apply the region names to the items
for (int i = 0; i < NavigationItems.Count; i++)
{
Region.SetName(NavigationItems[i], regionNames[i]);
}
NavigationViewControl.MenuItemsSource = NavigationItems; |
Beta Was this translation helpful? Give feedback.
-
Hello, I'm currently working on a project that dynamically creates a TreeView menu structure based on what modules the application has loaded. Basically, every piece of functionality of this program is a plugin that is loaded at runtime. When you select a tree item, I want to change the main content control to display whatever view the "plugin" needs to display.
I can load the assemblies, get their menu items, and add them to the tree. I have defined a ContentControl with a region name but am unclear on navigating the region. Based on my exploration, it appears that I might misunderstand how regions work in Uno. I come from Prism and WPF development, where defining a region sets up an area on a View where other content can be displayed. You could use multiple regions that all navigate separately to create composite views. That is to say, in prism, you Navigate a region, and it changes what content is displayed in that region.
It appears, based on documentation about Navigation Region here: https://platform.uno/docs/articles/external/uno.extensions/doc/Reference/Navigation/NavigationRegion.html, that Uno behaves differently. It looks like in Uno, a Region is a place to navigate to. So you would define your regions for something like a NavigationView, and then when you navigate TO a region, it would update the NavigationViews Content. Is my understanding correct? If that's the case, it seems like my use case is not a good one for Navigation or Regions, and I might need to roll my own system that replaces content control content.
What I was expecting to do was define a region and then, when navigating, provide a View to display in that region on navigation. It also appears the examples rely on the content's visibility for navigation. So, all possible views are defined up-front, and then visibility is toggled to navigate between them. I was looking for something that would let me unload views when you navigate to and from them. Sort of like Prisms OnNavigateTo and OnNavigateFrom methods in the INavigationAware interface.
Also, I think my question is similar to this one #13011, but looking at the Tab bar raised other questions on regions in Uno vs. Prism. Any help would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions