我有Windows Phone 8.当我把我的应用程序放在后台,然后当我开始一段时间后,由于墓碑,我似乎是黑色的。我找到了TombstoneHelper
类的解决方案。但我有一个小问题是它是否可以支持Windows Phone 8.因为我看到的每个地方我只发现了Wp7 TombstoneHelper
。所以这有点令人困惑。我的应用程序中有两个TextBox,它们在Tombstone之后变为空。这是我的xaml代码:
<Grid x:Name="LayoutRoot" Background="Transparent">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
<Grid.RowDefinitions>
<RowDefinition Height="70"/>
<RowDefinition Height="70"/>
<RowDefinition Height="70"/>
<RowDefinition Height="70"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<TextBlock Text="Firstname :" Grid.Row="0" Grid.Column="0"/>
<TextBox Text=""
Grid.Row="0" Grid.Column="1"/>
<TextBlock Text="Lastname :" Grid.Row="1" Grid.Column="0"/>
<TextBox
Grid.Row="1" Grid.Column="1"/>
<TextBlock x:Name="txt" Text="" Grid.Row="2"></TextBlock>
</Grid>
</Grid>
C#代码是:
`public MainPage()
{
InitializeComponent();
}
protected override void znNavigatingFrom(System.Windows.Navigation.NavigatingCancelEventArgs e)
{
this.SaveState(e, typeof(TextBox));
}
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
this.RestoreState();
}`