// MainWindow.cs
[DllImport("USER32.DLL")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool SetForegroundWindow(IntPtr hWnd);
public static void ActivatePopup(Popup popup)
{
//try to get a handle on the popup itself (via its child)
HwndSource source = (HwndSource)PresentationSource.FromVisual(popup.Child);
IntPtr handle = source.Handle;
//activate the popup
SetForegroundWindow(handle);
}
// Popup
private void popup_PreviewMouseDown(object sender, MouseButtonEventArgs e)
{
ActivatePopup(popup);
}
자세한 설명은 하단 링크를 참조하심이…