--> 아래 그림과 같이 '솔루션 탐색기'에서 "Video"폴더를 새로만들고, Video폴더 안에 "동영상파일"인 'Silverlight.wmv'을 추가한 후 "Video"폴더를 잘라내서, "ClientBin"폴더에 붙여넣기 한다. 







-------------------------------------------------------------------------------------




[MainPage.xaml]


<UserControl x:Class="RiaMediaElement.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">

        <StackPanel>

            <MediaElement

                x:Name="myVideo"

                Source="Video/Silverlight.wmv"

                AutoPlay="False"

                IsMuted="False">

            </MediaElement>

            <StackPanel Orientation="Horizontal">

                <Button x:Name="btnStart" Content="재생"></Button>

                <Button x:Name="btnStop" Content="중지"></Button>

            </StackPanel>

        </StackPanel>

    </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 RiaMediaElement

{

    public partial class MainPage : UserControl

    {

        public MainPage()

        {

            InitializeComponent();

 

            btnStart.Click += new RoutedEventHandler(btnStart_Click);

            btnStop.Click += new RoutedEventHandler(btnStop_Click);

        }

 

        void btnStop_Click(object sender, RoutedEventArgs e)

        {

            myVideo.Stop(); // 중지

        }

 

        void btnStart_Click(object sender, RoutedEventArgs e)

        {

            //myVideo.AutoPlay = true;

            myVideo.Play(); // 재생

        }

    }

}

 

 


-------------------------------------------------------------------------------------

 


[실행결과]











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

<EllipseGeometry>  (0) 2009.11.26
<LineGeometry>  (0) 2009.11.26
<Image /> 컨트롤  (0) 2009.11.26
도형(Shape) - <Path> : 모든 모양  (0) 2009.11.25
도형(Shape) - <Polygon> : 다각형(닫혀있는 모양)  (0) 2009.11.25
Posted by holland14
: