PageRenderTime 40ms CodeModel.GetById 27ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

/Visual Studio 2008/VBSL3MediaElement/VBSL3MediaElement/MainPage.xaml

#
XAML | 139 lines | 131 code | 5 blank | 3 comment | 0 complexity | 785de86a3a7b2284120bc1aeb5ccdc41 MD5 | raw file
  1<UserControl x:Class="VBSL3MediaElement.MainPage"
  2    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
  3    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  4    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
  5    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480">
  6    <UserControl.Resources>
  7        <!--We define a style for the Slider control so that we can hook up the DragStarted/DragCompleted event of
  8        the Thumb control in it. -->
  9        <Style x:Key="SliderStyle1" TargetType="Slider">
 10            <Setter Property="BorderThickness" Value="1"/>
 11            <Setter Property="Maximum" Value="10"/>
 12            <Setter Property="Minimum" Value="0"/>
 13            <Setter Property="Value" Value="0"/>
 14            <Setter Property="BorderBrush">
 15                <Setter.Value>
 16                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
 17                        <GradientStop Color="#FFA3AEB9" Offset="0"/>
 18                        <GradientStop Color="#FF8399A9" Offset="0.375"/>
 19                        <GradientStop Color="#FF718597" Offset="0.375"/>
 20                        <GradientStop Color="#FF617584" Offset="1"/>
 21                    </LinearGradientBrush>
 22                </Setter.Value>
 23            </Setter>
 24            <Setter Property="IsTabStop" Value="False"/>
 25            <Setter Property="Template">
 26                <Setter.Value>
 27                    <ControlTemplate TargetType="Slider">
 28                        <Grid x:Name="Root">
 29                            <Grid.Resources>
 30                                <ControlTemplate x:Key="RepeatButtonTemplate">
 31                                    <Grid x:Name="Root" Opacity="0" Background="Transparent"/>
 32                                </ControlTemplate>
 33                            </Grid.Resources>
 34                            <VisualStateManager.VisualStateGroups>
 35                                <VisualStateGroup x:Name="CommonStates">
 36                                    <VisualState x:Name="Normal"/>
 37                                    <VisualState x:Name="MouseOver"/>
 38                                    <VisualState x:Name="Disabled">
 39                                        <Storyboard>
 40                                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="HorizontalTrackRectangleDisabledOverlay" Storyboard.TargetProperty="Visibility">
 41                                                <DiscreteObjectKeyFrame KeyTime="0">
 42                                                    <DiscreteObjectKeyFrame.Value>
 43                                                        <Visibility>Visible</Visibility>
 44                                                    </DiscreteObjectKeyFrame.Value>
 45                                                </DiscreteObjectKeyFrame>
 46                                            </ObjectAnimationUsingKeyFrames>
 47                                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="ThumbDisabledOverlay" Storyboard.TargetProperty="Visibility">
 48                                                <DiscreteObjectKeyFrame KeyTime="0">
 49                                                    <DiscreteObjectKeyFrame.Value>
 50                                                        <Visibility>Visible</Visibility>
 51                                                    </DiscreteObjectKeyFrame.Value>
 52                                                </DiscreteObjectKeyFrame>
 53                                            </ObjectAnimationUsingKeyFrames>
 54                                            <ObjectAnimationUsingKeyFrames Duration="0" Storyboard.TargetName="VerticalTrackRectangleDisabledOverlay" Storyboard.TargetProperty="Visibility">
 55                                                <DiscreteObjectKeyFrame KeyTime="0">
 56                                                    <DiscreteObjectKeyFrame.Value>
 57                                                        <Visibility>Visible</Visibility>
 58                                                    </DiscreteObjectKeyFrame.Value>
 59                                                </DiscreteObjectKeyFrame>
 60                                            </ObjectAnimationUsingKeyFrames>
 61                                        </Storyboard>
 62                                    </VisualState>
 63                                </VisualStateGroup>
 64                            </VisualStateManager.VisualStateGroups>
 65                            <Grid x:Name="HorizontalTemplate" Background="{TemplateBinding Background}">
 66                                <Grid.ColumnDefinitions>
 67                                    <ColumnDefinition Width="Auto"/>
 68                                    <ColumnDefinition Width="Auto"/>
 69                                    <ColumnDefinition Width="*"/>
 70                                </Grid.ColumnDefinitions>
 71                                <Rectangle x:Name="TrackRectangle" Fill="#FFE6EFF7" Stroke="#FFA3AEB9" StrokeThickness="{TemplateBinding BorderThickness}" RadiusX="1" RadiusY="1" Height="3" Margin="5,0,5,0" Grid.Column="0" Grid.ColumnSpan="3"/>
 72                                <Rectangle x:Name="HorizontalTrackRectangleDisabledOverlay" Fill="White" RadiusX="1" RadiusY="1" Height="3" Margin="5,0,5,0" Opacity=".55" Visibility="Collapsed" Grid.Column="0" Grid.ColumnSpan="3"/>
 73                                <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton" Height="18" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Column="0"/>
 74                                <!--We're using HorizontalThumb to show the progress, so only need to add event handler for the Thumb below-->
 75                                <Thumb DragStarted="HorizontalThumb_DragStarted" DragCompleted="HorizontalThumb_DragCompleted" x:Name="HorizontalThumb" Height="18" Width="11" IsTabStop="True" Grid.Column="1"/>
 76                                <Rectangle x:Name="ThumbDisabledOverlay" Fill="White" RadiusX="2" RadiusY="2" Width="11" Opacity=".55" Visibility="Collapsed" Grid.Column="1"/>
 77                                <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton" Height="18" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Column="2"/>
 78                            </Grid>
 79                            <Grid x:Name="VerticalTemplate" Visibility="Collapsed" Background="{TemplateBinding Background}">
 80                                <Grid.RowDefinitions>
 81                                    <RowDefinition Height="*"/>
 82                                    <RowDefinition Height="Auto"/>
 83                                    <RowDefinition Height="Auto"/>
 84                                </Grid.RowDefinitions>
 85                                <Rectangle Fill="#FFE6EFF7" Stroke="#FFA3AEB9" StrokeThickness="{TemplateBinding BorderThickness}" RadiusX="1" RadiusY="1" Margin="0,5,0,5" Width="3" Grid.Row="0" Grid.RowSpan="3"/>
 86                                <Rectangle x:Name="VerticalTrackRectangleDisabledOverlay" Fill="White" RadiusX="1" RadiusY="1" Margin="0,5,0,5" Width="3" Opacity=".55" Visibility="Collapsed" Grid.Row="0" Grid.RowSpan="3"/>
 87                                <RepeatButton x:Name="VerticalTrackLargeChangeDecreaseRepeatButton" Width="18" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Row="2"/>
 88                                <Thumb x:Name="VerticalThumb" Height="11" Width="18" IsTabStop="True" Grid.Row="1"/>
 89                                <RepeatButton x:Name="VerticalTrackLargeChangeIncreaseRepeatButton" Width="18" IsTabStop="False" Template="{StaticResource RepeatButtonTemplate}" Grid.Row="0"/>
 90                            </Grid>
 91                        </Grid>
 92                    </ControlTemplate>
 93                </Setter.Value>
 94            </Setter>
 95        </Style>
 96    </UserControl.Resources>
 97
 98    <Grid x:Name="LayoutRoot">
 99        <ScrollViewer HorizontalScrollBarVisibility="Auto">
100            <StackPanel VerticalAlignment="Top">
101                <TextBlock HorizontalAlignment="Center" Text="MediaElement Sample" FontSize="24"></TextBlock>
102                <StackPanel x:Name="FullScreenPanel" Background="Gray" Visibility="Collapsed">
103                    <TextBlock FontSize="20" Text="This is FullScreenPanel. For the simplicity only a TextBlock is added here. Please click ESC to exit full screen mode"></TextBlock>
104                </StackPanel>
105                <MediaElement MediaFailed="MyMediaElement_MediaFailed" MarkerReached="MyMediaElement_MarkerReached" MediaEnded="MyMediaElement_MediaEnded" MediaOpened="MyMediaElement_MediaOpened" CurrentStateChanged="MyMediaElement_CurrentStateChanged" x:Name="MyMediaElement" AutoPlay="False" HorizontalAlignment="Center" VerticalAlignment="Center" Source="http://silverlight.services.live.com/104657/Industrial/video.wmv"/>
106                <StackPanel x:Name="MenuPanel" Margin="0,100">
107                    <StackPanel Orientation="Horizontal" HorizontalAlignment="Center">
108                        <Button Width="80" Height="30" Content="Play" x:Name="PlayButton" Click="PlayButton_Click"></Button>
109                        <Button Width="80" Height="30" Content="Pause" x:Name="PauseButton" Click="PauseButton_Click"></Button>
110                        <Button Width="80" Height="30" Content="Stop" x:Name="StopButton" Click="StopButton_Click"></Button>
111                        <Button Width="80" Height="30" Content="FullScreen" x:Name="FullScreenButton" Click="FullScreenButton_Click"></Button>
112                        <TextBlock Text="Progress: " Margin="10,0,0,0" VerticalAlignment="Center">
113                        </TextBlock>
114                        <Slider IsEnabled="False" x:Name="CurrentPositionSlider" Width="200" Height="30" Style="{StaticResource SliderStyle1}"></Slider>
115                        <TextBlock Text="Volume: " Margin="10,0,0,0" VerticalAlignment="Center">
116                        </TextBlock>
117                        <Slider x:Name="VolumeSlider" Width="100" Height="30" ValueChanged="VolumeSlider_ValueChanged" Maximum="1" Minimum="0"></Slider>
118                    </StackPanel>
119                    <Grid d:LayoutOverrides="Width">
120                        <Grid.ColumnDefinitions>
121                            <ColumnDefinition Width="4*"></ColumnDefinition>
122                            <ColumnDefinition Width="6*"></ColumnDefinition>
123                        </Grid.ColumnDefinitions>
124                        <StackPanel Orientation="Horizontal" Grid.Column="0" HorizontalAlignment="Left" Margin="0" d:LayoutOverrides="HorizontalAlignment">
125                            <TextBlock x:Name="StatusTextBlock"></TextBlock>
126                            <TextBlock Margin="30,0,0,0" x:Name="CurrentPositionTextBlock" Text="0:0:0/"></TextBlock>
127                            <TextBlock x:Name="DurationTextBlock"></TextBlock>
128                        </StackPanel>
129                        <TextBlock FontSize="12" Grid.Column="1" x:Name="CaptionTextBlock" Margin="0"/>
130                    </Grid>
131                </StackPanel>
132
133
134            </StackPanel>
135        </ScrollViewer>
136
137
138    </Grid>
139</UserControl>