We will create a new Silverlight project from Visual Studio 2010 4 Beta 2 and was appointed Demo.SL4.WebcamMic. Accept the default options for creating the Web project test. MainPage.xaml have the following code:
Code:
<UserControl
x: Class = "Demo.SL4.WebcamMic.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: ignore = "d"
xmlns: tk = "clr-namespace: System.Windows.Controls; assembly = System.Windows.Controls.Toolkit"
d: DesignHeight = "300" d: DesignWidth = "800">
<UserControl.Resources>
<Style TargetType = "TextBlock">
<Setter Property = "Foreground"
Value = "White" />
<Setter Property = "VerticalAlignment"
Value = "Center" />
<Setter Property = "Margin"
Value = "5" />
</ Style>
<Style TargetType = "Button">
<Setter Property = "Width"
Value = "100" />
<Setter Property = "Margin"
Value = "5" />
<Setter Property = "FontSize"
Value = "14" />
</ Style>
</ UserControl.Resources>
<Grid x: Name = "LayoutRoot" Background = "Black">
<Grid.RowDefinitions>
<RowDefinition Height = "50" />
<RowDefinition Height = "150" />
<RowDefinition Height = "35" />
<RowDefinition />
</ Grid.RowDefinitions>
<TextBlock Text = "Silverlight 4 Beta - Webcam and Microphone"
FontSize = "30"
HorizontalAlignment = "Center"
/>
<Rectangle x: Name = "capture"
Grid.Row = "1"
Width = "120"
Height = "120"
RadiusX = "10"
RadiusY = "10"
Stroke = "White"
StrokeThickness = "3">
<Rectangle.Fill>
<RadialGradientBrush>
<GradientStop Color = "White"
Offset = "0005" />
<GradientStop Color = "Black"
Offset = "0.20" />
</ RadialGradientBrush>
</ Rectangle.Fill>
</ Rectangle>
<StackPanel Orientation = "Horizontal" Grid.Row = "2" HorizontalAlignment = "Center">
<Button Content = "Start" Click = "Button_Click" Tag = "Start" />
<Button Content = "Stop" Click = "Button_Click" Tag = "Stop" />
<Button Content = "Delete" Click = "Button_Click" Tag = "Delete" />
<TextBlock Text = "Interval:" />
<Slider Width = "100" Height = "20" Minimum = "1" Maximum = "10" SmallChange = "1" x: Name = "range" />
<TextBlock Text = "(Binding Value, ElementName = interval)" />
<TextBlock Text = "second (s)" />
</ StackPanel>
<ListBox x: Name = "listaFotos"
Grid.Row = "3" Margin = "5" Background = "LightGray"
ScrollViewer.HorizontalScrollBarVisibility = "Disabled"
>
<ListBox.ItemTemplate>
<DataTemplate>
<Image Source = "(Binding)"
Width = "100">
<Image.Effect>
<DropShadowEffect />
</ Image.Effect>
</ Image>
</ DataTemplate>
</ ListBox.ItemTemplate>
<ListBox.ItemsPanel>
<ItemsPanelTemplate>
<Tk: WrapPanel />
</ ItemsPanelTemplate>
</ ListBox.ItemsPanel>
</ ListBox>
</ Grid>
</ UserControl>
Bookmarks