WP7 MVVM lightning talk

11
7 MVVM DEVELOPMENT Windows Phone ® In Approximately 10 Minutes

description

A super short guide to MVVM with Windows Phone 7 development

Transcript of WP7 MVVM lightning talk

Page 1: WP7 MVVM lightning talk

7MVVM DEVELOPMENTWindows Phone®

In Approximately 10 Minutes

Page 2: WP7 MVVM lightning talk

tools

Visual Studio 2010

WP7 SDK 7.1

app hub membershi

pMVVM

Framework

Page 3: WP7 MVVM lightning talk

XAMLexample

page

content

Page 4: WP7 MVVM lightning talk

XAML

<phone:PhoneApplicationPage x:Class="My_RSS.Views.AddFeed" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone" xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" FontFamily="{StaticResource PhoneFontFamilyNormal}" FontSize="{StaticResource PhoneFontSizeNormal}" Foreground="{StaticResource PhoneForegroundBrush}" SupportedOrientations="Portrait" Orientation="Portrait" mc:Ignorable="d" d:DesignHeight="696" d:DesignWidth="480" shell:SystemTray.IsVisible="True">

example

page

content

Page 5: WP7 MVVM lightning talk

XAML <shell:SystemTray.ProgressIndicator> <shell:ProgressIndicator IsIndeterminate="true" IsVisible="{Binding IsLoadingProgressVisible}" Text="{Binding ProgressText}" /> </shell:SystemTray.ProgressIndicator> <Grid x:Name="LayoutRoot" Background="Transparent"> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"> <TextBlock x:Name="ApplicationTitle" Text="{Binding AppTitle}" Style="{StaticResource PhoneTextNormalStyle}"/> <TextBlock x:Name="PageTitle" Text="add feed" Margin="9,-7,0,0" Style="{StaticResource PhoneTextTitle1Style}"/> </StackPanel> <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0"> <StackPanel> <toolkit:PhoneTextBox Hint="RSS Feed URL" x:Name="feedUrl" Text="{Binding FeedUrl}" /> </StackPanel> </Grid> </Grid> <phone:PhoneApplicationPage.ApplicationBar> <shell:ApplicationBar x:Name="saveFeed" IsMenuEnabled="True"> <shell:ApplicationBarIconButton IsEnabled="False" x:Name="saveButton" IconUri="/Content/Themes/Dark/appbar.save.rest.png" Text="save" Click="saveButton_Click" /> </shell:ApplicationBar> </phone:PhoneApplicationPage.ApplicationBar>

example

page

content

Page 6: WP7 MVVM lightning talk

MVVM

View-Model

Model View

Commands(e.g. events)

Data Binding(two way)

Page 7: WP7 MVVM lightning talk

MVVMmodelviewview-model

Page 8: WP7 MVVM lightning talk

MVVMmodelviewview-model

Page 9: WP7 MVVM lightning talk

MVVMmodelviewview-model

Page 10: WP7 MVVM lightning talk

solution bitsApp.xaml.cs & App.xaml– Tombstoning handlers– Static application resources

WMAppManifest.xml– Tile information– Splash screen– Scheduled tasks – App capabilities (camera, location etc…)

Page 11: WP7 MVVM lightning talk

questions

Thanks for listening