【发布时间】:2017-03-17 05:27:05
【问题描述】:
我想在 WPF 页面加载时显示一个进度条。我使用媒体元素来显示 gif 图像。下面的代码描述了我所做的。
<Page x:Class="WpfApplication3.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
Title="Page1" Loaded="Page_Loaded">
<Grid>
<MediaElement Grid.Column="2" Grid.Row="4" Margin="0,0,47,0" HorizontalAlignment="Right" Width="80" Source="progress.gif" LoadedBehavior="Manual" Name="MP"/>
</Grid>
</Page>
private void Page_Loaded(object sender, RoutedEventArgs e)
{
MP.Play();
}
但此进度条未显示在页面中 我怎样才能解决这个问题。 (当我也尝试使用进度条时,遇到了同样的问题)
(在窗口中可以正常工作)
【问题讨论】:
-
你检查过你的 gif 资源了吗?用IE等浏览器打开效果好不好
-
是的。即使它在 Windows 应用程序中也能正常工作
-
你的操作系统和目标框架版本是什么
标签: c# wpf progress-bar mediaelement