我想在網頁視圖的一部分,與此類似應用的半透明「玻璃」層:UWP web視圖與「玻璃」層不接收指針/觸摸事件
XAML :
<Page
x:Class="Sample.BlankPage1"
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"
mc:Ignorable="d">
<Grid>
<WebView
Source="http://news.google.com"
/>
<Rectangle
Fill="Red"
Opacity="0.25"
IsHitTestVisible="False"
MaxWidth="200"
/>
</Grid>
</Page>
代碼隱藏:
using Windows.UI.Xaml.Controls;
namespace Sample
{
public sealed partial class BlankPage1 : Page
{
public BlankPage1()
{
InitializeComponent();
}
}
}
的問題是,鼠標懸停在紅色矩形上時,鼠標指針是一個箭頭(當懸停在超鏈接上時),並且點擊/單擊對WebView沒有影響。它看起來像「IsHitTestVisible = False」實際上不工作,並且WebView沒有接收事件。
我發現了一個解釋命中測試的文檔(https://msdn.microsoft.com/library/windows/apps/hh758286#hit_testing),它說「WebView控件具有特殊的命中測試行爲」 - 但仍然看起來我的示例應該起作用。
的問題是:
- 是當前的行爲的錯誤嗎?
- 是否有解決方法?
謝謝。