简体   繁体   中英

WPF System.ComponentModel.Win32Exception (0x80004005): Invalid window handle

I'm getting the following error on WPF. I'm using MVVM databinding to DataContext + CollectionViewSources on the Window. There is too much code in the View Model and View to post, but I'm wondering where to look to find this as no line number comes up.

The window is using WPF databinding with converters, some Telerik controls in there also.

This is after calling

TabItemSelectionEditor.UpdateLayout() 

TabItemSelectionEditor is a System.Windows.Control.TabItem

System.ComponentModel.Win32Exception (0x80004005): Invalid window handle

at MS.Win32.UnsafeNativeMethods.GetWindowText(HandleRef hWnd, StringBuilder lpString, Int32 nMaxCount)

at System.Windows.Automation.Peers.WindowAutomationPeer.GetNameCore()

at System.Windows.Automation.Peers.AutomationPeer.UpdateSubtree()

at System.Windows.ContextLayoutManager.fireAutomationEvents()

at System.Windows.ContextLayoutManager.UpdateLayout()

at System.Windows.UIElement.UpdateLayout()

at System.Windows.Controls.VirtualizingStackPanel.<>c_ DisplayClassb.b _7()

at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)

at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)

Inner Exception is nothing!

Do you not have a DisplayClass method in your code?

I can also see that there is a VirtualizingStackPanel involved and the error occurred when it called the UIElement.UpdateLayout() method on its children.

That's about all that I can work out from this error and without any more information, I can't help any further.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM