Replies: 1 comment
-
WPF UI support CommunityToolkit and Microsoft.Toolkit.Mvvm. You can pass data to the page using dependency injection pattern. You can see an example of use in the constructor here Dependency injection for WPF looks like this:
In order for WPF UI to correctly understand pages as services, you need to create a special service named wpfui/src/Wpf.Ui.Demo/App.xaml.cs Line 58 in 838cd35 Then you need to tell your navigation control like wpfui/src/Wpf.Ui.Demo/Views/Container.xaml.cs Line 102 in 838cd35 |
Beta Was this translation helpful? Give feedback.
-
My page has a constructor that needs an object passed through to open. Is there a way to pass an object through using the page navigation in wpfui?
Class object = new Class();
Page myPage = new Page(object);
(Application.Current.MainWindow as Container)?.RootNavigation.Navigate("myPage", object);
(The aforementioned code not taking the object I'm attempting to pass through)
Beta Was this translation helpful? Give feedback.
All reactions