Multiple Sounds : vb « Windows Presentation Foundation « C# / C Sharp






Multiple Sounds

Multiple Sounds
     

<Window x:Class="SoundAndVideo.MultipleSounds"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Title="MultipleSounds" Height="300" Width="300">
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition></RowDefinition>
        <RowDefinition></RowDefinition>
      </Grid.RowDefinitions>
      <MediaElement x:Name="media1" Volume="0.25"></MediaElement>
      <MediaElement x:Name="media2" Volume="1"></MediaElement>
      <Button>
        <Button.Content>Click.</Button.Content>
        <Button.Triggers>
          <EventTrigger RoutedEvent="Button.Click">
            <EventTrigger.Actions>
            <BeginStoryboard>
              <Storyboard>
                <MediaTimeline Source="c:\song.mp3" Storyboard.TargetName="media1"></MediaTimeline>
              </Storyboard>
            </BeginStoryboard>
            </EventTrigger.Actions>
          </EventTrigger>
        </Button.Triggers>
      </Button>

      <Button Grid.Row="1">
        <Button.Content >wav</Button.Content>
        <Button.Triggers>
          <EventTrigger RoutedEvent="Button.Click">
            <EventTrigger.Actions>
              <BeginStoryboard>
                <Storyboard>
                  <MediaTimeline Source="c:\song.wav" Storyboard.TargetName="media2"></MediaTimeline>
                </Storyboard>
              </BeginStoryboard>
            </EventTrigger.Actions>
          </EventTrigger>
        </Button.Triggers>
      </Button>
    </Grid>
</Window>

   
    
    
    
    
  








Related examples in the same category

1.RotateRotate
2.TranslateTranslate
3.Gradient brushes within a DrawingBrushGradient brushes within a DrawingBrush
4.Applies a RotateTransform to the DrawingBrush's RelativeTransform propertyApplies a RotateTransform to the DrawingBrush's RelativeTransform property
5.Style resource with predefined static resourceStyle resource with predefined static resource
6.The Opacity Mask Use the opacity mask brush as a fill to show what it looks likeThe Opacity Mask Use the opacity mask brush as a fill to show what it looks like
7.Desktop to AppWorkspaceDesktop to AppWorkspace
8.StackPanel.Orientation=VerticalStackPanel.Orientation=Vertical
9.Line Joins MiterLine Joins Miter
10.Reference SystemColorsReference SystemColors
11.Document StylesDocument Styles
12.Animated Text TransformAnimated Text Transform
13.Discrete Point JumpsDiscrete Point Jumps
14.Resource LookupResource Lookup
15.Horizontal Linear Gradient and GradientStopHorizontal Linear Gradient and GradientStop
16.Reflected GradientReflected Gradient
17.Multicolored GradientMulticolored Gradient
18.Shape UnionShape Union
19.Shape XorShape Xor
20.Shape ExcludeShape Exclude
21.A Delay of 0 and Interval of 1 make this a fast slider.A Delay of 0 and Interval of 1 make this a fast slider.
22.Normal Slider (Max=100, Val=10)Normal Slider (Max=100, Val=10)