Must Read

Abuse in Nursing Homes

Many elderly Americans suffer abuse in their nursing homes each year. This unfortunate fact is only made more unfortunate...

4 Expensive Mortgage Refinance Mistakes

There are many benefits that a mortgage refinance can have for a homeowner. However, if just one thing is...

Should You Take Second Mortgage or Home Equity Loans

You need to use your house as equity to get some extra cash. However, you don't know whether you...

Useful College Loan Repayment Tips

Having some difficulties repaying your student loan debts?You're in luck because this article has simple but really effective college...

Avoiding Home Refinance Scams

As is the case with any other industry, you have to be careful when you are thinking about home...

The Disadvantages of Student Loan Consolidation

Student loan consolidation is a debt repayment solution that most borrowers opt for however what most of these people...

The Tailspin mobile client application uses only a small number of pages, with a limited number of navigation routes between those pages.

Figure 3 shows how the user navigates within the application on the phone.

Navigation in the Surveys client application

Note: Navigating to the SurveyDetailsView page is done through a context menu that appears when the user taps and holds on a survey name in the list.

The application determines the initial screen to display, based on the DefaultTask element in the WMAppManifest.xml fi le. The following code example shows how the application is confi gured to fi rst display the SurveyListView page to the user.

<DefaultTask Name =”_default” NavigationPage=”Views/SurveyList/SurveyListView.xaml”/>

Before users can use the application, they must enter the credentials that will be used when the application synchronizes with the Tailspin Surveys service. The developers at Tailspin considered automatically navigating users to the AppSettingsView page if they haven’t already supplied their credentials, but this introduced an issue with the way navigation behaves in the application. If the application automatically navigates the user to the AppSettingsView page from the SurveyListView page, and if the user then decides he or she doesn’t want to enter credentials (maybe the application was started by mistake), the user will press the Back button and expect to leave the application. A simple approach to navigating will have left the Survey- ListView page on the navigation stack, so that’s where the user will
end up. For some possible solutions to this problem, see the post, “Redirecting an initial navigation,” on Peter Torr’s blog (http://blogs.

The current version of the application does not automatically navigate users to the AppSettingsView page; instead, it displays a message that explains to users that they must provide their credentials. The following code example from the SurveyListView.xaml file shows how the visibility of the message is controlled based on the value of the SettingAreNotConfigured property.

<StackPanel x:Name=”SettingNotConfiguredPanel” Grid.Row=”0″ Margin=”24,24,0,12″ Visibility=”{Binding SettingAreNotConfigured, Converter={StaticResource VisibilityConverter}}”>
<TextBlock x:Name=”ApplicationTitle” Text=”TAILSPIN SURVEYS” Style=”{StaticResource PhoneTextNormalStyle}”/>
<TextBlock x:Name=”PageTitle” Text=”Surveys” Margin=”-3,-8,0,0″ Style=”{StaticResource PhoneTextTitle1Style}”/>
<ContentControl Template=”{StaticResource SettingsNotConfiguredTextBlock}” />

The following code example from the Styles.xaml file shows the template that defines the message.

<ControlTemplate x:Key=”SettingsNotConfiguredTextBlock”>
<TextBlock HorizontalAlignment=”Stretch” VerticalAlignment=”Top” Margin=”50,50,50,0″ Style=”{StaticResource PhoneTextLargeStyle}” Foreground=”{StaticResource PhoneSubtleBrush}”Text=”To start using TailSpin for Windows Phone 7, configure your Settings.” TextWrapping=”Wrap”/>

When you navigate using the NavigationService class, the behavior of the Back button is automatically determined, so using the Back button on the SurveyListView page causes the application to exit, and using the Back button on the AppSettingsView page returns the user to the SurveyListView page.

The following code example from the AppSettingsViewModel class shows how the application implements the navigation away from the AppSettingsView page in code for the Cancel button. Notice how the Cancel method uses the NavigationService class. This class is described in detail later in this chapter in the section, “Handling Navigation Requests.”

public void Cancel()

Navigating from the survey list screen to an individual survey is a little more complicated because the application must display the survey that the user currently has selected in the list. Furthermore, the application must respond to the user tapping on an item in a ListBox control, on a PivotItem in a PivotControl.

When the user taps a survey name in the list, the navigation to the TakeSurveyView page is accomplished using a custom behavior in the SurveyDataTemplate data template. The following code example from the Styles.xaml page shows this data template definition.

<DataTemplate x:Key=”SurveyDataTemplate”>

<pag:FrameworkElementClickCommand CommandBinding=”{Binding TakeSurveyCommand}”/>


The custom behavior that enables navigation from a click on an item in the ListBox control is defined in the FrameworkElement-ClickCommand infrastructure class. This infrastructure class binds a command to a user tap on an element in the view—in this example, a tap on an item in a list to the TakeSurveyCommand command in the SurveyTemplateViewModel view model class.

For an explanation of how the TakeSurveyView page displays the correct survey, based on the survey selected in the list.

Tapping and holding on a survey name on the SurveyListView page displays a context menu with two options: the user can toggle whether the survey is a favorite to display in the favorites list or the user can display the SurveyDetailsView page.


Latest News

Digital Marketing for Beginners

Digital marketing for starter, Let to basic learning about connecting with your audience in the right place at the...

What are 7 things poor people do that the rich don’t?

1. poor people watch TV in which people read books how many hours you spend in front of the TV and when was the...

Top 18 best small business ideas for beginners starting

A small business can be frightening and requires plenty of careful planning there are many small business ideas which can be beneficial as well...

Summer that makes you happy

We saw were already here I've been thinking about some of the things. I used to do with my husband even though he had...

4 Point to helpful tips specifically for caregivers

What you need to take a vacation. I know it sounds impossible creative and try to make it work for you almost everyone needs...

More Articles Like This