ユーザーがページ間を移動できるアプリケーションを作成したくない場合 (および戻るボタンを使用して戻ることができない場合) は、単一のページに基づいてアプリケーションを作成できます。以下は、 Windows Phone アプリケーションプロジェクトを作成する場合に Visual Studio が作成するものの一部を変更したバージョンです。
<phone:PhoneApplicationPage
x:Class="PhoneApp1.MainPage"
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"
mc:Ignorable="d" d:DesignWidth="480" d:DesignHeight="728"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}">
<Grid Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<StackPanel Margin="12,17,0,28">
<TextBlock
Text="MY APPLICATION"
Style="{StaticResource PhoneTextNormalStyle}"/>
<TextBlock
Text="page name"
Margin="9,-7,0,0"
Style="{StaticResource PhoneTextTitle1Style}"/>
</StackPanel>
<Grid Grid.Row="1" Margin="12,0,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<!-- The three buttons -->
<StackPanel Orientation="Horizontal">
<Button Content="Button 1"/>
<Button Content="Button 2"/>
<Button Content="Button 3"/>
</StackPanel>
<!-- The main content -->
<TextBlock Grid.Row="1"
Text="Content always changing"
Style="{StaticResource PhoneTextTitle1Style}"
TextWrapping="Wrap"
TextAlignment="Center"/>
</Grid>
</Grid>
<phone:PhoneApplicationPage.ApplicationBar>
<shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
<shell:ApplicationBarIconButton
IconUri="/Images/appbar_button1.png"
Text="Button 1"/>
<shell:ApplicationBarIconButton
IconUri="/Images/appbar_button2.png"
Text="Button 2"/>
<shell:ApplicationBar.MenuItems>
<shell:ApplicationBarMenuItem Text="MenuItem 1"/>
<shell:ApplicationBarMenuItem Text="MenuItem 2"/>
</shell:ApplicationBar.MenuItems>
</shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>
</phone:PhoneApplicationPage>
そして、これがデザイナーでどのように見えるかです:

この場合、メイン コンテンツ (常に変化する) は<TextBlock>
ですが、他のコントロールまたは で構成されたパネルを使用できますUserControl
。複数のパネル/コントロールを同じグリッド セルに配置する場合、1 つのパネル/コントロールを除くすべてを非表示にすることで、レイアウトを完全に変更できます。
ボタンの一番上の行には水平<StackPanel>
を使用しましたが、レイアウトと配置をより適切に制御するために別のものを使用することをお勧めします。
ボタンの一番下の行には、標準の Windows Phone 7 ユーザー エクスペリエンスの一部である appbar を使用する必要があります。