Example #1
0
        private void SetCollapsableState()
        {
            if (Environment.OSVersion.Version.Major < 6)
                return;

            foreach (ListViewGroup group in Groups)
            {
                var placeHolderGroup = new NthListViewGroup();
                placeHolderGroup.CbSize = Marshal.SizeOf(placeHolderGroup);
                placeHolderGroup.State = _areGroupsCollapsable ? NthListViewGroupState.Collapsible : NthListViewGroupState.Normal;
                placeHolderGroup.Mask = NthListViewGroupMask.State;
                placeHolderGroup.GroupId = GetGroupId(group);

                if (placeHolderGroup.GroupId < 0)
                    continue;

                NativeMethods.SendMessage(Handle, (int)LVM.LVM_SETGROUPINFO, new IntPtr(placeHolderGroup.GroupId), ref placeHolderGroup);
                // TODO: Verify if the object is directly handled over by reference or just copied

            }
        }
 internal static extern IntPtr SendMessage(IntPtr hWnd, int msg, IntPtr wParam, ref NthListViewGroup lParam);