WPF 后台绑定样式


 

 private ContentControl cc = null;

private void muiscPlay(object sender, RoutedEventArgs e)
{
string name = ((ContentControl)sender).Tag.ToString();
if (string.IsNullOrWhiteSpace(name))
return;
if (filename != name)
{
player.Stop();
isStart = true;
if (cc != null)
cc.SetResourceReference(System.Windows.Controls.Button.StyleProperty, "playButtonStyle2");
player.LoadedBehavior = MediaState.Manual;
player.Source = new Uri("./Resource/musics/" + name, UriKind.Relative);
filename = name;
}
if (isStart)
{
player.Play();
((ContentControl)sender).SetResourceReference(System.Windows.Controls.Button.StyleProperty, "pauseButtonStyle2");
cc = ((ContentControl)sender);
isStart = false;
}
else
{
player.Pause();
((ContentControl)sender).SetResourceReference(System.Windows.Controls.Button.StyleProperty, "playButtonStyle2");
isStart = true;
}
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM