so I am needing to have to pages have webviews in my UWP application. I have them set in the muxc:NavigationViewItem when I navigate to them I am able to see the web page load in but when I got to interact with the page I am unable to do anything at all. I have switched it back to the normal NavigationViewItem and onve I do that I have no issues with interacting with the page inside the webview. Is the Webview not supported in a muxc:NavigationView? Any help on this issue would mean the world, thanks!
Here is the code that interacting with a webpage inside Webview doesn't work
<muxc:NavigationView OpenPaneLength="175"
x:Name="NavView"
ItemInvoked="NavView_ItemInvoked"
Loaded="NavView_Loaded"
IsSettingsVisible="True"
IsBackButtonVisible="Collapsed">
<muxc:NavigationView.MenuItems>
<muxc:NavigationViewItem Icon="Home" Content="Home" Tag="Home" />
<muxc:NavigationViewItem Content="Create New Report" Tag="CreateNewReport" >
<muxc:NavigationViewItem.Icon>
<BitmapIcon UriSource="./Assets/TestIcon.png" />
</muxc:NavigationViewItem.Icon>
</muxc:NavigationViewItem>
<muxc:NavigationViewItem Icon="Bookmarks" Content="Daily Log" Tag="DailyLog" />
<muxc:NavigationViewItem Icon="Keyboard" Content="CAD" Tag="CAD" />
<muxc:NavigationViewItem Icon="Calculator" Content="MULES" Tag="MULES" />
<muxc:NavigationViewItem Icon="World" Content="MARS Workflow" Tag="MARSWorkflow" />
<!--<NavigationViewItem Icon="Find" Content="MARS Search" Tag="MARSSearch" />-->
</muxc:NavigationView.MenuItems>
<ScrollViewer >
<Frame Name="ContentFrame" />
</ScrollViewer>
</muxc:NavigationView>
Code that allows for interaction inside a Webview
<NavigationView OpenPaneLength="175"
x:Name="NavView"
ItemInvoked="NavView_ItemInvoked"
Loaded="NavView_Loaded"
IsSettingsVisible="True"
IsBackButtonVisible="Collapsed">
<NavigationView.MenuItems>
<NavigationViewItem Icon="Home" Content="Home" Tag="Home" />
<NavigationViewItem Content="Create New Report" Tag="CreateNewReport" >
<NavigationViewItem.Icon>
<BitmapIcon UriSource="./Assets/TestIcon.png" />
</NavigationViewItem.Icon>
</NavigationViewItem>
<NavigationViewItem Icon="Bookmarks" Content="Daily Log" Tag="DailyLog" />
<NavigationViewItem Icon="Keyboard" Content="CAD" Tag="CAD" />
<NavigationViewItem Icon="Calculator" Content="MULES" Tag="MULES" />
<NavigationViewItem Icon="World" Content="MARS Workflow" Tag="MARSWorkflow" />
<!--<NavigationViewItem Icon="Find" Content="MARS Search" Tag="MARSSearch" />-->
<NavigationView.MenuItems>
<ScrollViewer >
<Frame Name="ContentFrame" />
</ScrollViewer>
</NavigationView>
CodePudding user response:
I could reproduce this on my side. This is a known issue that has been reported on WinUI Github issues-Unable to Interact with WebView in WinUI 2.6.
The reason for this behavior is that the rounding of the navigation view content area makes it unable to interact. So as a workaround, please try to set NavigationViewContentGridCornerRadius
to 0. After that, the code works on my side.
Please put the following code into the Page where you place the muxc:NavigationView .
<Page.Resources>
<CornerRadius x:Key="NavigationViewContentGridCornerRadius">0</CornerRadius>
</Page.Resources>