Hello,
If you open the second window programmatically, you can pass data directly via the constructor.
var secondWindow = new NewWindow1("this a data from first window");
Application.Current.OpenWindow(secondWindow);
In the Second Window.
public partial class NewWindow1 : Window
{
public NewWindow1(string dataService )
{
InitializeComponent();
Page = new NewPage1(dataService);
}
}
Or you use CommunityToolkit's WeakReferenceMessenger
Best Regards,
Leon Lu
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.