* 동영상 파일인 "Silverlight.wmv"파일을 아래 그림과 같이 "ClientBin"폴더에 추가한다.








* 볼륨은 0(음소거)부터 최대1까지이다.





[MainPage.xaml]


<UserControl x:Class="RiaSlider.MainPage"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

 

    <Grid x:Name="LayoutRoot" Background="White">

        <MediaElement x:Name="media" Width="640" Height="480"

            Source="Silverlight.wmv" />

        <TextBlock Text="볼륨조절" />

        <Slider x:Name="slider" Maximum="1" Minimum="0" Width="200"

            Value="0.5" SmallChange="0.1"

        />

    </Grid>

</UserControl>

 









[MainPage.xaml.cs]


using System;

using System.Collections.Generic;

using System.Linq;

using System.Net;

using System.Windows;

using System.Windows.Controls;

using System.Windows.Documents;

using System.Windows.Input;

using System.Windows.Media;

using System.Windows.Media.Animation;

using System.Windows.Shapes;

 

namespace RiaSlider

{

    public partial class MainPage : UserControl

    {

        public MainPage()

        {

            InitializeComponent();

 

            this.slider.ValueChanged += new RoutedPropertyChangedEventHandler<double>(slider_ValueChanged);

        }

 

        void slider_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)

        {

            this.media.Volume = this.slider.Value; // 0~1까지의 볼륨 조절 가능

        }

    }

}
















'.NET프로그래밍 > Silverlight 3.0' 카테고리의 다른 글

Calendar 컨트롤  (0) 2009.12.02
TabControl 컨트롤  (0) 2009.12.02
ProgressBar 컨트롤  (0) 2009.12.02
ListBox 컨트롤  (0) 2009.12.02
ComboBox 컨트롤 (여러개의 항목 중 하나를 선택 가능)  (0) 2009.12.02
Posted by holland14
: