code-behind inline inside event handler
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
精彩评论