Hello, Welcome to Micorosoft Q&A,
My app has 8 pages and one User Control that contains code common to all pages.
For this scenario, the better way is using Messenger notification tool that comes from mvvmlight to send the message from UserrControl to focued page.
For example
using GalaSoft.MvvmLight.Messaging;
private void Button_Click(object sender, RoutedEventArgs e)
{
var message = "Test";
Messenger.Default.Send<string,TestPage>(message);
Tbk.Text = message;
}
Target Page
public TestPage()
{
this.InitializeComponent();
this.Loaded += TestPage_Loaded;
}
private void TestPage_Loaded(object sender, RoutedEventArgs e)
{
Messenger.Default.Register<string>(this, (s) =>
{
MyTextBlock.Text = s;
});
}
If the response is helpful, please click "Accept Answer" and upvote it.
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.