dutts / wpfmdi

A library to add the traditional Windows Forms Multiple Document Interface (MDI) features to WPF. The aim is to resemble the original as much as possible.
Apache License 2.0
66 stars 32 forks source link

Flashing window, Focus loop #2

Open NayaraFJ opened 6 years ago

NayaraFJ commented 6 years ago

Hello I used your class in my project, however I have a problem and I can not solve it. I made a program to open the last windows that were open in the last session of the user. But the program loops in the Focus methods, but the downloaded example opens the windows direct and does not loop, I did the test opening empty windows and it worked, this loop is generated only when I put my controls in, I'm not getting to understand, Has anyone had this problem?

NayaraFJ commented 6 years ago

I solved

In method "FocusedValueChanged" I changed this line

mdiChild.Dispatcher.BeginInvoke(new Func<IInputElement, IInputElement>(Keyboard.Focus), System.Windows.Threading.DispatcherPriority.ApplicationIdle, mdiChild.Content);

for this

mdiChild.Dispatcher.BeginInvoke(new Func<IInputElement, IInputElement>(Keyboard.Focus), System.Windows.Threading.DispatcherPriority.ApplicationIdle, mdiChild);