wpf 在 popup 中打字,输入法被遮挡问题处理。

需要将焦点强制赋值到popup的child上面

        FocusElement(myPopup.Child)


     public static void FocusElement(UIElement ui) { SetFocus(((System.Windows.Interop.HwndSource)PresentationSource.FromVisual(ui)).Handle); } [System.Runtime.InteropServices.DllImport("user32")] public static extern IntPtr SetFocus(IntPtr hWnd);

 

posted @ 2026-01-29 15:43  echo三毛  阅读(0)  评论(0)    收藏  举报