I am trying to use a media player to play music from a collection of songs .
Is it possible to encode that the music being played cannot be paused?
Below is my code:
private void songListBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { songSelectedIndex = songListBox.SelectedIndex; using (var ml = new MediaLibrary()) { FrameworkDispatcher.Update(); MediaPlayer.Play(ml.Songs[songSelectedIndex]); MediaPlayer.IsRepeating = true; MediaPlayer.Volume = 20.0f; } }
I tried using CanPauseProperty but there is an error
MediaElement.CanPauseProperty = false;
Error: Unable to implicitly convert type 'bool' to 'System.Windows.DependencyProperty'
source share