切换输入法 输入不了中文
1 [DllImport("User32.dll")] 2 public static extern IntPtr SetFocus(IntPtr hWnd); 3 4 IntPtr GetHwnd(Popup popup) 5 { 6 HwndSource source = (HwndSource)PresentationSource.FromVisual(popup.Child); 7 return source.Handle; 8 } 9 10 private void ShowPopupButtonClick(object sender, RoutedEventArgs e) 11 { 12 ThePopup.IsOpen = true; 13 IntPtr handle = GetHwnd(ThePopup); 14 SetFocus(handle); 15 }