-
Hello, <Grid uen:Region.Attached="True">
<NavigationView uen:Region.Attached="true">
<NavigationView.MenuItems>
<NavigationViewItem Content="Products"
uen:Region.Name="Project"
uen:Navigation.Data="{Binding Name, Mode=TwoWay}"/>
</NavigationView.MenuItems> The [ObservableProperty]
private string? name; For the Projectspage i've defined a private static void RegisterRoutes(IViewRegistry views, IRouteRegistry routes)
{
views.Register(
new ViewMap(ViewModel: typeof(ShellViewModel)),
new ViewMap<MainPage, MainViewModel>(),
new DataViewMap<ProjectPage, ProjectViewModel, string>()
);
routes.Register(
new RouteMap("", View: views.FindByViewModel<ShellViewModel>(),
Nested:
[
new ("Main", View: views.FindByViewModel<MainViewModel>()),
new ("Project", View: views.FindByViewModel<ProjectViewModel>()),
]
)
);
} I get a Breakpoint on the contructor for ProjectViewModel but the string is null. Of Course this is a Simple example. My goal is to initialize Objects in MainViewModel and to inject these Data to VMs of other pages i want to navigate through NavigationView. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Seems like if |
Beta Was this translation helpful? Give feedback.
-
Have you confirmed that it works if you use ViewModel-based navigation? Meaning you could define a Command in your MainModel that is bound using CommandExtensions.Command on your NavigationView: https://platform.uno/docs/articles/external/uno.toolkit.ui/doc/helpers/command-extensions.html#breadcrumb And then in your command you Navigate using NavigateViewModelAsync/DataAsync: https://platform.uno/docs/articles/external/uno.extensions/doc/Learn/Navigation/HowTo-NavigateInCode.html ? |
Beta Was this translation helpful? Give feedback.
Seems like if
uen:Region.Name="Project"
is replaced withuen:Navigation.Request="./Project"
it kinda works. Still don't know whyuen:Region.Name
ignores theNavigation.Data