Reputation: 1304
I am trying to use the media player to play a music from the song collection.
Is it possible to code that the playing music cannot be pause?
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 to use the CanPauseProperty but there is an error
MediaElement.CanPauseProperty = false;
Error: Cannot implicitly convert type 'bool' to 'System.Windows.DependencyProperty'
Upvotes: 4
Views: 739
Reputation: 65586
MediaPlayer does not support this ability.
If you were using the BackgroundAudioPlayer (in Mango) then you can control which navigation options are available.
Upvotes: 1