ComponentOne MediaPlayer for WPF and Silverlight
Setting the Initial Volume
C1MediaPlayer Task-Based Help > Setting the Initial Volume

You can set the initial volume setting of the C1MediaPlayer control by setting the C1MediaPlayer.Volume property to a value between 0 and 1. In this topic, you will set the volume so that it's at its midway point upon page load.

At Design Time

To set the volume, complete the following steps:

  1. Click the C1MediaPlayer control once to select it.
  2. In the Properties window (or Properties panel in Blend), set the Volume property to "0.5".
  3. Run the program and observe that the C1MediaPlayer control's volume is set halfway.

In XAML

To set the volume, complete the following steps:

  1. Add Volume="0.5" to the <c1mediaplayer:C1MediaPlayer> tag so that the markup resembles the following:
    <c1mediaplayer:C1MediaPlayer Name="C1MediaPlayer1" Volume="0.5">
    
  2. Run the program and observe that the C1MediaPlayer control's volume is set halfway.

In Code

To set the volume, complete the following steps:

  1. Open the Window1.xaml.cs page.
  2. Add x:Name="C1MediaPlayer1" to the <c1ext:C1MediaPlayer> tag so that the control will have a unique identifier for you to call in code.
  3. Place the following code beneath the InitializeComponent() method:

    Visual Basic
    Copy Code
    C1MediaPlayer1.Volume = 0.5
    

     

    C#
    Copy Code
    c1MediaPlayer1.Volume = 0.5;
    

     

  4. Run the program and observe that the C1MediaPlayer control's volume is set halfway.