I am writing a Visual Studio extension for our Dev team (a VSIX solution). When the user activates the extension, they get a form which is a very simple WPF window. The window is loaded using the following code:
var myWindow = new SomeWpfWindow(myArgs)
{
Owner = Application.Current.MainWindow
};
myWindow.Show();
This opens and displays a form that the user fills in. The form has lots of TextBoxes that undergo 2-way binding to the DataContext. Nothing too out of the ordinary.
Well, apart from the TextBox behaviour....
When I type characters in the textbox ("blah blah blah") then I see these characters displayed in the text box, and they also get written to the DataContext property that they're bound to.
However. When I press the back-space or delete button, then the text in the TextBox remains unchanged, but instead the window behind (in this case, the active code file) is edited. Not ideal behaviour....
I fixed this by using .ShowDialog() rather than .Show(), but is is the correct fix, or am I just burying the problem?
Thanks