I'm building a WPF application using WPF UI. In my MainWindow, I have a NavigationView that loads pages when menu items are clicked. One of these pages contains a WebView, and that page has a button that triggers a custom dialog through a ContentPresenter defined in the MainWindow.
The problem:
The custom dialog appears behind the WebView.
This only happens on pages containing the WebView; other pages work fine.
MainWindow.xaml (Simplified)
<ui:FluentWindow ...>
<Grid>
<ui:NavigationView
x:Name="NavigationView"
SelectionChanged="OnNavigationSelectionChanged">
<ui:NavigationView.ContentOverlay>
<Grid>
<ui:SnackbarPresenter x:Name="SnackbarPresenter" />
</Grid>
</ui:NavigationView.ContentOverlay>
</ui:NavigationView>
<!-- Global dialog container -->
<ContentPresenter x:Name="RootContentDialog" Grid.Row="0" />
</Grid>
</ui:FluentWindow>
WebViewPage.xaml (Loaded into Navigation)
<Grid>
<WebView x:Name="MyWebView" />
<Button Content="Open Dialog" Click="OnOpenDialogClicked" />
</Grid>
Code-Behind (Button Click)
private void OnOpenDialogClicked(object sender, RoutedEventArgs e)
{
RootContentDialog.Content = new MyCustomDialog();
RootContentDialog.Visibility = Visibility.Visible;
}
It looks like the WebView is hosted in a separate HWND, causing the dialog to stay behind.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744307193a4567772.html
评论列表(0条)