如何从其他帧(第二帧)折叠对象(第一帧中)WUA
本文关键字:WUA 对象 一帧 折叠 其他 二帧 | 更新日期: 2023-09-27 18:35:12
我有一个简单的问题(希望如此)。我需要崩溃(或做一些其他更改)从其他表单/框架(子或子或)在表单/框架中反对父母),但我不知道该怎么做。很高兴提到我是开发 Windows 通用应用程序。而且我还需要从中加载帧其他帧到其他帧...
我喜欢让它非常简单易懂,这就是为什么我喜欢展示非常简单的例子我的意思。
对不起我的英语,不是我的母语。
页面一 XAML
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<StackPanel Grid.Row="0">
<Button Content="LoadFrame" Click="Button_Click"/>
<Button x:Name="KillMeOne" Content="Kill Me From Frame Two"/>
</StackPanel>
<Frame x:Name="TheSecondFrame" Grid.Row="1"/>
<Frame x:Name="FrameThreeComesHere" Grid.Row="2"/>
</Grid>
第二页 XAML
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<StackPanel>
<Button Content="Load Frame Three From Here Form In 'FrameThreeComesHere-frame' But How?"/>
<Button Content="Kill The Button From Page One But How?"/>
</StackPanel>
</Grid>
第三页 XAML
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<TextBlock Text="HelloWord!"/>
</Grid>
第一页CS代码...
private void Button_Click(object sender, RoutedEventArgs e)
{
TheSecondFrame.Navigate(typeof(PageTwo));
}
为第 1 页创建数据上下文,将要隐藏的元素的可见性绑定到数据上下文的属性。然后从第 2 页获取第 1 页的数据上下文,更改属性以更改第 1 页上元素的可见性。