internal GroupManager this[IntPtr hwnd]
        {
            get
            {
                if (!WindowsListView.IsGroupViewEnabled(hwnd))
                {
                    // Group was disabled but we did not get the needed event
                    // since for some things events are not being sent
                    // (e.g: Going from some LV modes to - List mode, List mode does not have Groups)

                    // alexsn @


                    throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
                }

                // The group may have been discarded by the reorder winevent.
                EnsureCreation(hwnd);

                GroupManager manager = _groupManagers[hwnd] as GroupManager;
                if (manager == null)
                {
                    // E.G. Going from the List mode to the something that has Group will cause this

                    // alexsn @


                    throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
                }
                return(manager);
            }
        }
        internal GroupManager this[IntPtr hwnd]
        {
            get
            {
                if (!WindowsListView.IsGroupViewEnabled(hwnd))
                {
                    // Group was disabled but we did not get the needed event
                    // since for some things events are not being sent
                    // (e.g: Going from some LV modes to - List mode, List mode does not have Groups)

                    // Microsoft - We may want to consider raising the event here
                    // The M7 work on checking if LE is valid however is the better way of going
                    // WindowsListView.RemoveGroupAndRaiseLogicalChangedEvent(_hwnd);
                    throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
                }

                // The group may have been discarded by the reorder winevent.
                EnsureCreation(hwnd);

                GroupManager manager = _groupManagers[hwnd] as GroupManager;
                if (manager == null)
                {
                    // E.G. Going from the List mode to the something that has Group will cause this

                    // Microsoft- We may want to consider raising the event here
                    // The M7 work on checking if LE is valid however is the better way of going
                    // WindowsListView.RaiseLogicalChangedEvent(hwnd);
                    throw new InvalidOperationException(SR.Get(SRID.OperationCannotBePerformed));
                }
                return(manager);
            }
        }
示例#3
0
        //------------------------------------------------------
        //
        //  Patterns Implementation
        //
        //------------------------------------------------------

        #region ProxySimple Interface

        // Returns a pattern interface if supported.
        internal override object GetPatternProvider(AutomationPattern iid)
        {
            if (iid == GridPattern.Pattern)
            {
                return(this);
            }
            else if (iid == ExpandCollapsePattern.Pattern && WindowsListView.IsGroupViewEnabled(_hwnd))
            {
                return(this);
            }

            return(null);
        }
        // retrieve an id of the group to which this lvitem belongs
        // valid only if lv has groups enabled
        static internal int GetGroupID(IntPtr hwnd, int lvItem)
        {
            System.Diagnostics.Debug.Assert(WindowsListView.IsGroupViewEnabled(hwnd), "GetGroupID: called when lv does not have groups");

            NativeMethods.LVITEM_V6 item = new NativeMethods.LVITEM_V6();
            item.mask  = NativeMethods.LVIF_GROUPID;
            item.iItem = lvItem;

            if (XSendMessage.GetItem(hwnd, ref item))
            {
                return(item.iGroupID);
            }

            return(-1);
        }