namespace WpfApplication1 { public partial class MainWindow : Window { public MainWindow() { InitializeComponent(); Page1.onNameSend += Page1_onNameSend; } void Page1_onNameSend(string Name) { Console.WriteLine(Name); } } }
And then in your Page1:
namespace WpfApplication1 { public partial class Page1 : Page { public delegate void SendName(string Name); public static event SendName onNameSend; public Page1() { InitializeComponent(); } private void SendButton(object sender, RoutedEventArgs e) { onNameSend("Name to Send"); } } }
Hope that helps.
Liked By
Write Answer
How to pass data between wpf page and a window
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy
Join MindStick Community
You have need login or register for voting of answers or question.
Pravesh Singh
23-Sep-2013You can use a delegateevent to do this.
For example in your MainWindow :
And then in your Page1:
Hope that helps.