如何从另一帧(第二帧)折叠对象(第一帧) WUA
Posted
技术标签:
【中文标题】如何从另一帧(第二帧)折叠对象(第一帧) WUA【英文标题】:How to collapse object (in frame one) from other frame (frame two) WUA 【发布时间】:2016-05-31 02:10:59 【问题描述】:我有一个简单的问题(希望如此)。我需要崩溃(或做一些 其他更改)从其他表单/框架(子或 父母),但我不知道该怎么做。很高兴提到我是 开发 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】:为第 1 页创建数据上下文,将要隐藏的元素的可见性绑定到数据上下文的属性。然后从Page 2,获取Page 1的数据上下文,改变属性改变Page 1上元素的Visibility。
【讨论】:
拜托,你能给我发一个小例子吗?我只是不明白。谢谢!以上是关于如何从另一帧(第二帧)折叠对象(第一帧) WUA的主要内容,如果未能解决你的问题,请参考以下文章