开发者

code-behind inline inside event handler

开发者 https://www.devze.com 2023-03-27 05:30 出处:网络
This xaml points to an event handler member function in the Completed event: <Storyboard x:Name=\"myStory\" Completed=\"myStoryCompleted\" FillBehavior=\"Stop\">

This xaml points to an event handler member function in the Completed event:

<Storyboard x:Name="myStory" Completed="myStoryCompleted" FillBehavior="Stop">
    <!-- storyboard things -->
</Storyboard>

As in my case I just want to play a simple sound when the Storyboard ends (don't know of a way to include sounds in a Storyboard!), 开发者_运维问答I'd like to have "inline codebehind" in that Completed... if it's possible. Is it? Something like this:

<Storyboard x:Name="myStory" Completed="{mysound.Play();}" FillBehavior="Stop">
    <!-- storyboard things -->
</Storyboard>

<MediaElement x:Name="mysound" Source="/mysound.mp3" Volume="100" />


Can you not just start thesound in code behind?

private void myStoryCompleted(object sender, EventArgs e)
{
    this.mysound.Play();
}


Seems not possible after all. :-P

0

精彩评论

暂无评论...
验证码 换一张
取 消