首页 > 解决方案 > 如何在 WPF 中创建忽略鼠标事件的覆盖弹出窗口?

问题描述

如何在 webview 控件之上创建一个半透明的弹出窗口,以便弹出窗口不会拦截鼠标事件?我希望鼠标与底层的 webview 控件内容进行交互,而不是弹出窗口。这可能吗?

下面是我的 xaml 片段:

    <Grid Name="windowGrid" Background="#FFDE0707">
        <StackPanel>

            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                </Grid.ColumnDefinitions>

                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>

                <Controls:WebView Grid.Row="0" Grid.Column="0" Name="wvc" Width="800" Height="800" HorizontalAlignment="Left" VerticalAlignment="Top" Source="http://www.google.ca" />

                <Popup PlacementTarget="{Binding ElementName=wvc}" Placement="Center" IsOpen="true" AllowsTransparency="True">
                    <Rectangle Height="400" Width="400"  Fill="Purple" Opacity="0.25" IsHitTestVisible="False" />
                </Popup>
            </Grid>

        </StackPanel>
    </Grid>

标签: c#wpfwebviewpopupmouse

解决方案


推荐阅读