In this section you will add media playback functionality to your created Music and Video pages, add new pages to present pictures, and use WebBrowser controls. Task 1 – Adding Media Element to Play Media Files During this task, you will add two new pages to the project. These pages will be used to present video content and play music files attached to the lab. If not already open, launch Visual Studio 2010 Express for Windows Phone from Start | All Programs | Microsoft Visual Studio 2010 Express | Microsoft Visual Studio 2010 Express for Windows Phone. Visual Studio 2010: Open Visual Studio 2010 from Start | All Programs | Microsoft Visual Studio 2010. If you completed the steps in the previous exercise, you may continue with the solution that you created for that exercise; otherwise, open Begin.sln from in the Source folder of the lab. Open the Default.xaml file from the Views\Video folder. Add the following markup snippet to the ContentPanel element: XAML <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <MediaElement x:Name="media" HorizontalAlignment="Stretch" AutoPlay="True" VerticalAlignment="Stretch" Stretch="Uniform" /> </Grid> Horizontal and Vertical Alignment properties get or set the alignment characteristics applied to a when it is composed within a layout parent, such as a panel or items control. Values include Left, Center, Right, Stretch for HorizontalAlignment, and Top, Center, Bottom, and Stretch for VerticalAlignment. The Stretch property stretches the element to fill the entire layout slot of the parent element. The Stretch property is very important when using media elements such as Image. Stretch determines how content is resized to fill its allocated space. Possible options for Stretch are: None - The content preserves its original size Fill - The content is resized to fill the destination dimensions without preserving the aspect ratio Uniform - The content is resized to fit in the destination dimensions while it preserves its native aspect ratio
In this section you will add media playback functionality to your created Music and Video pages, add new pages to present pictures, and use WebBrowser controls. Task 1 – Adding Media Element to Play Media Files During this task, you will add two new pages to the project. These pages will be used to present video content and play music files attached to the lab. If not already open, launch Visual Studio 2010 Express for Windows Phone from Start | All Programs | Microsoft Visual Studio 2010 Express | Microsoft Visual Studio 2010 Express for Windows Phone. Visual Studio 2010: Open Visual Studio 2010 from Start | All Programs | Microsoft Visual Studio 2010. If you completed the steps in the previous exercise, you may continue with the solution that you created for that exercise; otherwise, open Begin.sln from in the Source folder of the lab. Open the Default.xaml file from the Views\Video folder. Add the following markup snippet to the ContentPanel element: XAML <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <MediaElement x:Name="media" HorizontalAlignment="Stretch" AutoPlay="True" VerticalAlignment="Stretch" Stretch="Uniform" /> </Grid> Horizontal and Vertical Alignment properties get or set the alignment characteristics applied to a when it is composed within a layout parent, such as a panel or items control. Values include Left, Center, Right, Stretch for HorizontalAlignment, and Top, Center, Bottom, and Stretch for VerticalAlignment. The Stretch property stretches the element to fill the entire layout slot of the parent element. The Stretch property is very important when using media elements such as Image. Stretch determines how content is resized to fill its allocated space. Possible options for Stretch are: None - The content preserves its original size Fill - The content is resized to fill the destination dimensions without preserving the aspect ratio Uniform - The content is resized to fit in the destination dimensions while it preserves its native aspect ratio
WindowsPhoneNavigationAndControls.docx