internal static void RaiseEvents(IntPtr hwnd, int eventId, object idProp, int idObject, int idChild) { if (idObject != NativeMethods.OBJID_VSCROLL && idObject != NativeMethods.OBJID_HSCROLL) { ProxyFragment header = new WindowsSysHeader(hwnd); AutomationProperty property = idProp as AutomationProperty; if (property == TablePattern.ColumnHeadersProperty || property == TablePattern.RowHeadersProperty) { // Check if the parent is a ListView IntPtr hwndParent = NativeMethodsSetLastError.GetAncestor(hwnd, NativeMethods.GA_PARENT); if (hwndParent != IntPtr.Zero) { if (Misc.GetClassName(hwndParent).IndexOf("SysListView32", StringComparison.Ordinal) >= 0) { // Notify the Listview that the header Change WindowsListView wlv = (WindowsListView)WindowsListView.Create(hwndParent, 0); if (wlv != null) { wlv.DispatchEvents(eventId, idProp, idObject, idChild); } } } } else { if (idProp == InvokePattern.InvokedEvent) { ProxySimple headerItem = new HeaderItem(hwnd, header, idChild); headerItem.DispatchEvents(eventId, idProp, idObject, idChild); } else { header.DispatchEvents(eventId, idProp, idObject, idChild); } } } }