简体   繁体   English

Windows 8.1中MediaElement的样式

[英]Style of MediaElement in Windows 8.1

How can I change style of sample MediaElement : 如何更改示例MediaElement样式:

在此处输入图片说明

For example how can I change the background. 例如,如何更改背景。

Code: 码:

<MediaElement AudioCategory="BackgroundCapableMedia" x:Name="media" MediaEnded="Media_MediaEnded" AutoPlay="True" AreTransportControlsEnabled="True" IsMuted="False" Volume="0.5"/>

Actually you can change the colors by overriding the default colors in the App. 实际上,您可以通过覆盖应用程序中的默认颜色来更改颜色。 Note this would apply now for all MediaElement controls with transport controls, but it is possible. 请注意,这现在适用于所有带有传输控件的MediaElement控件,但是有可能。 In your App.xaml you would provide overrides for these values like this: 在您的App.xaml中,您将为这些值提供替代,如下所示:

  <Application.Resources>
      <SolidColorBrush x:Key="MediaButtonForegroundThemeBrush" Color="Blue" />
      <SolidColorBrush x:Key="MediaButtonBackgroundThemeBrush" Color="Transparent" />
      <SolidColorBrush x:Key="MediaButtonPointerOverForegroundThemeBrush" Color="#FFFFFFFF" />
      <SolidColorBrush x:Key="MediaButtonPointerOverBackgroundThemeBrush" Color="#26FFFFFF" />
      <SolidColorBrush x:Key="MediaButtonPressedForegroundThemeBrush" Color="#FF000000" />
      <SolidColorBrush x:Key="MediaButtonPressedBackgroundThemeBrush" Color="#FFFFFFFF" />
      <SolidColorBrush x:Key="MediaButtonPressedBorderThemeBrush" Color="#FFFFFFFF" />
      <SolidColorBrush x:Key="MediaControlPanelVideoThemeBrush" Color="Red" />
      <SolidColorBrush x:Key="MediaControlPanelAudioThemeBrush" Color="#FF000000" />
      <SolidColorBrush x:Key="MediaDownloadProgressIndicatorThemeBrush" Color="#38FFFFFF" />
      <SolidColorBrush x:Key="MediaErrorBackgroundThemeBrush" Color="#FF000000" />
      <SolidColorBrush x:Key="MediaTextThemeBrush" Color="#FFFFFFFF" />
  </Application.Resources>

This would give you a visual like this: 这将为您提供如下视觉效果: 在此处输入图片说明

Hope this helps! 希望这可以帮助!

I think if you do not want to write your own controlpanel with play-pause-stop controls, you can not change the background of this MediaElement rendered controlpanel because it is an overlay of the video and is designed to look MS/Windows8 conform . 我想,如果您不想编写带有播放暂停停止控件的控件面板,则不能更改此MediaElement呈现的控件MediaElement的背景,因为它是视频的叠加层,旨在与MS / Windows8兼容

Note: This controlpanel is also invisible if you do not mouse-over the video. 注意:如果您不将鼠标悬停在视频上,则该控制面板也是不可见的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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