سؤال

In WPF, when a new Window is shown, it is offset by maybe 10 pixels horizontally and vertically. Is there an easy way to prevent this, so the window opens directly over the one that triggered it? (They are the same size - consider it similar to an installer's behavior)

هل كانت مفيدة؟

المحلول

You should set the WindowStartupLocation property of all windows to CenterScreen value.

نصائح أخرى

You can set the Left and Top properties of the new window to be the same as the owner window. You should do this before you call the Show or ShowDialog methods.

Good luck,

M. Moshe

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top