我正在为 Windows 8 的音乐播放器创建音量滑块,但它抛出异常说:
'System.ArgumentException' occurred in Microsoft.Phone.ni.dll but was not handled in user code
我的代码:
<Slider x:Name="VolumeSlider" HorizontalAlignment="Left" Margin="18,563,0,0" VerticalAlignment="Top" Width="245" RenderTransformOrigin="0.467,-0.833" ValueChanged="ChangeMediaVolume" />
和
// Change the volume of the media.
private void ChangeMediaVolume(object sender, RoutedPropertyChangedEventArgs<double> args)
{
{
BackgroundAudioPlayer.Instance.Volume = (double)VolumeSlider.Value;
}
}
void InitializePropertyValues()
{
BackgroundAudioPlayer.Instance.Volume = (double)VolumeSlider.Value;
}