c# - Empty space appears at the top of ListView when removing Groups -


My music player uses ListView in description mode to show tracks, and list albums with group list With track.

I have created an event that removes all the albums in an album, when the album's list view group is middle-click, when the track is deleted, the ListView is not scrolled properly. If ListView is scrolled, the album will be deleted, but between the header and the first group, large non-clickable spaces appear at the top of the ListView.

The first image, 3 albums in the ListView (scrolled)

 Enter image details here


The second image, the last album removed, everything is fine!

Enter image details here


OK , Then scroll down at the time of removing a group of inventory items

The third image, 3 albums in the list W. (scroll down)

 Enter image details here


Fourth image, last album deleted, spaces appeared on top, and last track If ListView is not visible at all!

enter image details here


not me It seems to have something to do with my code, but there is a bug in the ListView? Did anyone see the same behavior? Is there any way to stop it from happening?


Edit: Added code which removes the item (as the user has requested)

  list & lt; ListViewItem & gt; DelItems = new list & lt; ListViewItem & gt; (); To create a list of items, foreach must be removed (ListView List 1 group in group list.) {If (Convert.ToInt32 (group.Tag) == groupNumber) // Individual number in tag group of all groups { Foreach (Items in ListViewItem group.Ams) {delItems.Add (item); }}} Foreach (visible item items in the list) {item.Remove (); }   

EDIT2: Code was added to check that the group was clicked

Since there is no real way to handle group clicks, I have it ugly Created in the manner. But this works first, I used the MouseDown event in ListView, then I check that there is an item where the user clicks. If the user clicks the group, the item is zero, and for the loop, I grow and check that if the item can now be found when the object is finally found, we know that the item is the group that we clicked on Is from That's why we receive the item group tag, where I tell you what this group is.

  See private zeros list 1_MouseDown (Object Sender, MouseEventArgs e) {ListViewItem Item; // content is not greater than 25 pixels (for int i = 0; i & lt; 25; i ++) {item = listView1.GetItemAt (E.X, EI + I); If (item! = Null) {if (i> 1) is greater than // 1, because the difference of 1 pixel during the list is when using groups (if (e.button == mouse button) RemovePlaylistGroup (Convert.ToInt32 (item.Group.Tag)); and {if (e.button == mousebutton.made) remove playlist item (item index);} breakdown;} <}    

All this was happening because ListView apparently fire Form1_Layout Event there, I use listView1 to use listView1.BeginUpdate () ... , If layout changes messes my view any kind.

Comments

Popular posts from this blog

c# - Textbox not clickable but editable -

Matlab transpose a table vector -

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -