I Have Code get IdUsers From Other Page
String IdUsers;
public Main_Wallets_Page()
{
InitializeComponent();
You shouldn't use MessageBoxes in OnNavigatedTo because if the user does not press a button your app will crash since the framework thinks that navigation has failed. MessageBoxes in the constructor are equally as bad.
I can think of two options (I use #1 for these sorts of things):
Show the MessageBox in the Loaded
event. But be careful it can be
fired more than once. In the constructor you might add the handler for the Loaded event and then in the handler you'd detach from the handler so that it is called only once.
Use Dispatcher.BeginInvoke
around the MessageBox.Show
call so that it does not block navigation. That might still block the Dispatcher thread. If you really wanted to go this route you could use ThreadPool.QueueUserWorkItem
or a TPL Task.
I also have used OnLayoutUpdated
in place of the Loaded
event but I can't remember exactly why :) It seems like it might have been that the page hasn't yet displayed in Loaded
and it has in the other event.