internal void UpdateGroupNative(ListViewGroupEx group, bool invalidate = true)
 {
     using (NativeMethods.LVGROUP nGroup = new NativeMethods.LVGROUP(group))
     {
         nGroup.SetState(NativeMethods.ListViewGroupState.Collapsible, collapsible);
         SendMessage(NativeMethods.ListViewMessage.SetGroupInfo, group.ID, nGroup);
     }
     if (invalidate)
     {
         base.Invalidate();
     }
 }
예제 #2
0
        private static void SetState(ListViewGroup group, NativeMethods.ListViewGroupState state, bool value)
        {
            int groupId = GetGroupId(group);

            if (groupId >= 0)
            {
                NativeMethods.LVGROUP lvgroup = new NativeMethods.LVGROUP(NativeMethods.ListViewGroupMask.State);
                {
                    lvgroup.SetState(state, value);
                    NativeMethods.SendMessage(group.ListView.Handle, (uint)NativeMethods.ListViewMessage.SetGroupInfo, (IntPtr)groupId, lvgroup);
                }
            }
        }
        private void SetAllGroupState(NativeMethods.ListViewGroupState state, bool on = true)
        {
            NativeMethods.LVGROUP group = new NativeMethods.LVGROUP(NativeMethods.ListViewGroupMask.State);
            group.SetState(state, on);
            //group.Subtitle = "Dog";

            foreach (ListViewGroup g in this.BaseGroups)
            {
                SendMessage(NativeMethods.ListViewMessage.SetGroupInfo, GetGroupId(g), group);
            }

            using (NativeMethods.LVGROUP grp = new NativeMethods.LVGROUP(NativeMethods.ListViewGroupMask.Subtitle))
            {
                int res = SendMessage(NativeMethods.ListViewMessage.GetGroupInfoByIndex, 0, grp);
                if (res >= 0)
                {
                    System.Diagnostics.Debug.WriteLine(grp.Subtitle);
                }
            }

            RecreateHandle();
        }
 internal void SetGroupState(ListViewGroupEx group, NativeMethods.ListViewGroupState item, bool value)
 {
     NativeMethods.LVGROUP mgroup = new NativeMethods.LVGROUP(NativeMethods.ListViewGroupMask.State);
     mgroup.SetState(item, value);
     SendMessage(NativeMethods.ListViewMessage.SetGroupInfo, GetGroupId(group), mgroup);
 }