我的Page1.xaml热几秒钟后,得到UWP从另一个页面内容
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel HorizontalAlignment="Left" Height="720" VerticalAlignment="Top" Width="575">
<TextBlock Foreground="White" TextWrapping="Wrap" Margin="28,20,31,0" FontSize="14" Height="145">
<TextBlock.Transitions>
<TransitionCollection>
<EntranceThemeTransition FromHorizontalOffset="400"/>
</TransitionCollection>
</TextBlock.Transitions>
<Run Text="Text 1"/>
</TextBlock>
</StackPanel>
</Grid>
而且Page2.xaml
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<TextBlock Foreground="White SelectionChanged="TextBlock_SelectionChanged"
Name="TextBlockOne">
<TextBlock.Transitions>
<TransitionCollection>
<EntranceThemeTransition FromHorizontalOffset="400"/>
</TransitionCollection>
</TextBlock.Transitions>
<Run Text="Text 2"/>
</TextBlock>
</Grid>
我想要做的是用第2页的“文本2”在5秒后替换第1页中的“文本1”。
我在Page2.xaml.cs中试过这个:
private void TextBlock_SelectionChanged(object sender, RoutedEventArgs e)
{
var test = TextBlockOne.Text;
Frame.Navigate(typeof(Page1), test);
}
我该如何解决这个问题?
代码什么问题呢? – Archana
保持一个计时器5秒钟,然后导航到页面1的文本值 – Archana
现在的问题是没有任何反应。我甚至无法从第2页获取文本值 – LittleBird