samedi 24 décembre 2016

C# WPF - How to Have CheckBoxes in a ListView?

I am currently creating an MP3 player in C# WPF. My MP3 player has a ListView on the side, which shows the full current playlist, allowing the user to choose a song, or let the MP3 player scroll through the songs. I am currently attempting to implement the following feature:

Having a CheckBox next to every item. When the current song is finished, if the next song IsChecked, then play it, otherwise, skip it.

I have searched extensively for an answer that suits me, however all I seem to find are answers which don't make sense to me, so I can't implement them to suit my program.

I have no idea how to even go about implementing this feature.

Since the songs are loaded from an openFileDialog, I can't find a way to programatically add CheckBoxes to every item in the ListView.

Moreover, I have attempted at using Wpf Extended Toolkit's CheckListBox control, however this wasn't suitable, as many of the events and/or properties of that control weren't the same as the ListView's, rendering some of the program's features unusable, such as the 'Revert Song Change' (plays back the previous song to the time at which the user changed it) or the feature to load the same songs as the ones when the program was closed.

If someone could lead me to an answer, or explain this to me in a simple manner, it would be greatly appreciated.

Thanks for the help.




Aucun commentaire:

Enregistrer un commentaire