1

在我的WP7应用程序中,我有 2 个页面,page1并且page2. 当用户导航到 时page2,我希望页面是透明的,以便page1可以在后台看到。我在中使用以下代码page2,但没有得到这种效果。

<phone:PhoneApplicationPage 
x:Class="BoxIt.Page3"
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"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
shell:SystemTray.IsVisible="True"
 Opacity="0">

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Opacity="0" Background="Transparent">


    <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <Canvas HorizontalAlignment="Center" VerticalAlignment="Center" Width="400" Height="400">
            <TextBlock FontSize="30"  FontFamily="{StaticResource PoloBrush}" Canvas.Left="24" Canvas.Top="53" Height="30" Name="tb1" Text="" />
            <TextBlock FontSize="30" FontFamily="{StaticResource PoloBrush}" Canvas.Left="24" Canvas.Top="147" Height="30" Name="tb2" Text="" />
            <Button  ManipulationStarted="button1_ManipulationStarted" FontFamily="{StaticResource PoloBrush}" Canvas.Left="24" Canvas.Top="267" Content="Play again" Height="72" Name="button1" Width="179" />
            <Button  ManipulationStarted="button2_ManipulationStarted" FontFamily="{StaticResource PoloBrush}" Canvas.Left="209" Canvas.Top="267" Content="Menu" Height="72" Name="button2" Width="160" />
        </Canvas>
    </Grid>
</Grid>

4

1 回答 1

2

你不能那样做。当您执行导航 -Page 1隐藏时,会出现第 2 页。所以,你看不到第一页。

您可以对第 1 页显示一些透明的控制(如 yogesh 所说)。

否则,您可以将第 1 页渲染为位图并将其用作第 2 页的背景。

但我认为这不是 Metro 风格。我会使用其他 UI 决定。

于 2012-10-06T11:38:39.167 回答