How to select text from another window?

0

Follow the code below:

MainWindow.cs:

" MainWindow ", has a textbox and the following code, shows a new window that is " Configuration ".

var window = new Configuracao
{
    Owner = this
};
window.ShowDialog();

Configuration.cs:

The following code is inside a click event of the button:

MainWindow mainWindow = Application.Current.Windows.OfType<MainWindow>().FirstOrDefault();
mainWindow.textbox_main.Focus();
mainWindow.textbox_main.SelectAll();

When I close the " Configuration " window, the text markup or text selection of the " MainWindow" window appears. It only works when I close the setup window. How can I select text with the window open? With the " Configuration " window open it does not "select text" from the "MainWindow" window.

Any solution?

    
asked by anonymous 10.04.2018 / 19:17

0 answers