0

MetroアプリでAppBarを使用しようとしています。問題は、AppBar上に表示されているWebViewもいくつかあることです。これが私のコードです:

<Page
x:Class="AppName.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:AppName"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid Background="#00D4FF" Canvas.ZIndex="1">
    <WebView Source="http://bing.com/"
        VerticalAlignment="Center" Margin="306,518,360,25" 
             Canvas.ZIndex="1" Height="225" />
</Grid>
<Page.BottomAppBar>
    <AppBar x:Name="ABar" IsSticky="True" Padding="10,0,10,0" Canvas.ZIndex="200">
        <Grid>
            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                <Button Style="{StaticResource EditAppBarButtonStyle}" x:Name="EditButton" Visibility="Collapsed" />
                <Button Style="{StaticResource AddAppBarButtonStyle}" />
                <Button Style="{StaticResource DeleteAppBarButtonStyle}" x:Name="DelButton" Visibility="Collapsed" />
            </StackPanel>
        </Grid>
    </AppBar>
</Page.BottomAppBar>

これを実行してappbarを表示すると、AppBarのCanvas.ZIndexがWebViewおよびグリッドのZIndexよりも高い場合でも、WebViewがappbarの上に表示されていることがわかります。これを防ぐにはどうすればよいですか?

4

1 に答える 1

1

アプリバーがアクティブなときにWebViewコンテンツを表示するWebViewBrushコントロールを使用する必要があります。アプリバーのshowイベントでは、WebViewコントロールを非表示にしてWebViewBrushを表示し、アプリバーのhideイベントではその逆を行います。これを実装する際のトリッキーな部分は、アニメーションのタイミングを正しく取得することです。

以下にリンクされている記事には、これを行う方法の例が含まれています。これはチャームバーに関連していますが、同じ原則です。

http://blogs.msdn.com/b/priozersk/archive/2012/08/13/how-to-display-charms-on-a-top-of-the-webview.aspx

于 2012-10-07T20:50:56.757 に答える