WPF获取窗体或控件句柄

在winform中获取窗口句柄很简单,this.Handle。但在wpf中这个有点麻烦。

窗体: 
IntPtr hwnd = new WindowInteropHelper(this).Handle;


控件: 
IntPtr hwnd = ((HwndSource)PresentationSource.FromVisual(uielement)).Handle;

原文地址:https://www.cnblogs.com/fornet/p/2976184.html