【发布时间】:2020-10-19 01:43:28
【问题描述】:
在 WPF Prism 7.2 中,我遵循了IDialogService instructions shown here。
我有一个 PlotsDialogPanel UserControl 和一个 ContentControl,如下所示:
<UserControl x:Class="PlotModule.Dialogs.Views.PlotsDialogPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True"
xmlns:local="clr-namespace:PlotModule.Dialogs.Views"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<prism:Dialog.WindowStyle>
<Style TargetType="Window">
<Setter Property="prism:Dialog.WindowStartupLocation" Value="CenterScreen" />
<Setter Property="ResizeMode" Value="CanResizeWithGrip"/>
<Setter Property="ShowInTaskbar" Value="True"/>
</Style>
</prism:Dialog.WindowStyle>
<Grid>
<ContentControl prism:RegionManager.RegionName="PlotsDialogDisplayRegion" />
</Grid>
</UserControl>
在我的PlotModule RegisterTypes 方法中我注册了对话框:
public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterDialog<PlotsDialogPanel, PlotsDialogPanelViewModel>();
}
但是当对话框显示在事件处理程序中时,它充当模式,它始终位于父级的最顶层。
private void MainMenuEventHandler(string inParameter)
{
_DialogService.Show("PlotsDialogPanel", new DialogParameters(), r => {});
}
我在这里看不到我做错了什么,关于为什么对话框表现得像模态的任何想法?其他一切都按预期工作,对话框显示并关闭,IDialogAware::OnDialogOpened 和 OnDialogClosed 按预期运行。
【问题讨论】: