简体   繁体   中英

Volume slider c# windows phone 7.1

I have some problem with a slider volume in my windows phone app 7.1

this is the XAML

<Slider Name="volumeSlider" VerticalAlignment="Center" ValueChanged="ChangeMediaVolume" Minimum="0" Maximum="1" Value="0.5" Margin="0,146,0,-27"/>

and this the simply function ChangeMediaVolume

private void ChangeMediaVolume(object sender, RoutedPropertyChangedEventArgs<double> args)
{
   AudioPlayer.Volume = (double)volumeSlider.Value;
}

If I don't have this lines all it's ok... but when they are in the code the debugger show an error.

A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in System.Windows.ni.dll

If there is a handler for this exception, the program may be safely continued.

Probably this is what's wrong with it. Try changing the line

<Slider Name="volumeSlider" ...

to

<Slider x:Name="volumeSlider" ...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM