我目前正在开发一个UWP应用程序,我的一个页面是在应用程序中显示一个网站。然而,我面临着一些问题 导航栏下拉列表 .
这个应用程序将在触摸屏设备上运行,问题来了。当我尝试在本地计算机上运行应用程序时,当我 悬停在上方
但当我在触摸屏设备上试用该应用程序时,下拉列表没有显示,页面被导航到导航栏中的“主标题”页面。
我想知道这是否是因为当我在触摸屏上尝试它时,我在导航栏中选择了“主标题”,它被认为是一个 因此,当我在我的电脑上运行时,它并没有执行它所做的操作 本地机器并悬停 导航栏。
这是我的密码。xaml:
<Page x:Class="CitiKiosk_v2.Views.WebsitePage" x:Name="pageRoot" DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="using:CitiKiosk_v2.Views" xmlns:common="using:CitiKiosk.Common" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d"> <Grid> <Grid.ChildrenTransitions> <TransitionCollection> </TransitionCollection> </Grid.ChildrenTransitions> <ProgressRing Height="64" Width="64" Name="WebViewLoadProgressRing" HorizontalAlignment="Center" VerticalAlignment="Center" IsActive="True" Foreground="White" /> <WebView Name="webView" Margin="0,0,0,20" Tapped="webView_Tapped" Source="http://www.nyp.edu.sg/schools/sit.html" NavigationStarting="webView_NavigationStarting" NavigationCompleted="webView_NavigationCompleted" PointerMoved="webView_PointerMoved" IsDoubleTapEnabled="False" IsHoldingEnabled="False" IsRightTapEnabled="False" IsTapEnabled="False" FlowDirection="RightToLeft" /> <CommandBar IsSticky="True" Name="WebViewCommandBar" Background="{StaticResource CitiKioskBackgroundBrush}" HorizontalAlignment="Stretch" VerticalAlignment="Bottom"> <CommandBar.Transitions> <TransitionCollection> </TransitionCollection> </CommandBar.Transitions> <AppBarButton Icon="Back" Label="Back" IsCompact="True" Foreground="White" IsEnabled="{Binding CanGoBack,ElementName=webView}" Name="WebViewBackButton" Click="WebViewBackButton_Click"/> <AppBarButton Icon="Forward" Label="Forward" IsCompact="True" Foreground="White" IsEnabled="{Binding CanGoForward,ElementName=webView}" Name="WebViewForwardButton" Click="WebViewForwardButton_Click" Margin="0 0 1500 0"/> <AppBarButton Icon="Refresh" Label="Refresh" IsCompact="True" Name="WebViewRefreshButton" Foreground="White" Click="WebViewRefreshButton_Click"/> </CommandBar> <ProgressBar Name="WebViewProgressBar" HorizontalAlignment="Stretch" Height="10" VerticalAlignment="Bottom" IsIndeterminate="True" Foreground="White" FontWeight="Bold"/> </Grid>
这有什么办法解决吗?非常感谢。
现在的问题是,你正在使用 webview . 黄金法则是在 网络视图 您无法控制渲染的内容。问题是,如果你想显示 website ,您使用 网络视图 但是在你的 网络视图 如果你不是网站的开发者,这有点失控。
webview
网络视图
website
问题是,有两件事 hover over 和 click ,当您将鼠标悬停在网站的导航栏上时 悬停在上方 事件被调用,并显示下拉列表。现在当你 tap(touch device) 在按钮上,您正在呼叫 点击 事件,因此它会被导航,但不提供下拉列表。
hover over
click
悬停在上方
tap(touch device)
点击