如何将WebBrowser控件放置在其他控件的下方? [英] How to place a WebBrowser control below other controls?

查看:13
本文介绍了如何将WebBrowser控件放置在其他控件的下方?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试设置Canvar.ZIndex属性,但当我滚动时,WebBrowser控件中的HTML仍然漂浮在Silverlight导航应用程序的菜单栏上方。

您可以看到下面的示例代码:

我刚刚创建了一个空的Silverlight导航应用程序,并在Home.XAML中添加了以下内容:

<navigation:Page x:Class="Test.Home" 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
    mc:Ignorable="d" d:DesignWidth="640" d:DesignHeight="480"
    Title="Home"
    Style="{StaticResource PageStyle}" Canvas.ZIndex="1">

    <Grid x:Name="LayoutRoot">
        <ScrollViewer x:Name="PageScrollViewer" Style="{StaticResource PageScrollViewerStyle}">

            <StackPanel x:Name="ContentStackPanel">

                <TextBlock x:Name="HeaderText" Style="{StaticResource HeaderTextStyle}" 
                                   Text="Home Content"/>
                <TextBlock x:Name="lblInstructions" Style="{StaticResource ContentTextStyle}" 
                                   Text="Instructions "/>
                <WebBrowser Name="HTMLContent" Height="850" Width="600" Canvas.ZIndex="0" />
                <TextBlock x:Name="lblScribble" Style="{StaticResource ContentTextStyle}" 
                                   Text="Scribble here "/>
                <InkPresenter Name="inkPresenter1" DataContext="{Binding}" Cursor="Stylus" Opacity="1" />
            </StackPanel>

        </ScrollViewer>
    </Grid>

然后将代码中的HTML内容设置在后面:

HTMLContent.NavigateToString("<p>Some HTML</p>");

向下滚动时,HTML内容位于顶部的导航上方。这告诉我,WebBrowser控件位于其余控件之上。但设置Canvar.ZIndex没有任何作用。

推荐答案

这是一个常见的airspace issue,类似于WPF airspace issue。目前无法将其显示在其他Silverlight内容的后面。

(对于第一个链接,搜索"空域"以查找相关信息)。

这篇关于如何将WebBrowser控件放置在其他控件的下方?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆