【发布时间】:2011-08-10 19:39:36
【问题描述】:
我正在尝试在 WP7 中打开页面时实现此流程:
播放故事板“闪烁”⇒播放声音⇒播放故事板“运动”
如您在代码中所见,我将声音添加为 MediaElement。我必须设置 AutoPlay="False",否则声音会在页面打开时立即播放。
问题是,当眨眼故事板结束时,声音永远不会播放。我将 MediaEnded 触发器附加到 MediaElement 上,相信它会引用 MediaElement 中指定的声音。但它什么也没做。我尝试在 PlaySoundAction 的“Source”属性中再次指定声音,但它仍然不播放声音。我认为 MediaElement 的“autoplay=false”是罪魁祸首,但我无法如上所述将其删除。
<MediaElement x:Name="mysound" HorizontalAlignment="Left" Height="0" Source="/mysound.mp3" Stretch="Fill" VerticalAlignment="Top" Width="0" Volume="1" AutoPlay="False">
<i:Interaction.Triggers>
<i:EventTrigger EventName="MediaEnded">
<eim:ControlStoryboardAction Storyboard="{StaticResource movement}"/>
</i:EventTrigger>
<eim:StoryboardCompletedTrigger Storyboard="{StaticResource blink}">
<eim:PlaySoundAction Volume="1"/>
</eim:StoryboardCompletedTrigger>
</i:Interaction.Triggers>
</MediaElement>
【问题讨论】:
-
我最初想为所有内容制作一个大故事板,但似乎不存在将声音添加到故事板中的方法,或者有吗??
标签: windows-phone-7 expression-blend