Prism.Interactivity.InteractionRequest.Confirmation 未显示。为什么? [已关闭]

问题描述 投票:0回答:1

我正在使用源自 Prism.Interactivity.InteractionRequest.Confirmation 的

OwnConfirmation

我有两种方法,
methodWorkWithDetails
HandleConfirmation

此代码正在运行:

public void methodWorkWithDetails(Confirmation c)
{
    do_Something(); // Breakpoint 2
    ...
}

...
public void Some_Method(...)
{
    var confirmation = ModuleManager.UnityContainer.Resolve<OwnConfirmation>();
    confirmation.Title = $"...";
    confirmation.Content = new ChangeOwnControlModal(posy, LocationName);
    confirmation.BackgroundColor = Colors.LightSteelBlue;

    OwnControlRequest.Raise(confirmation, methodWorkWithDetails); // Breakpoint 1
}

我如何知道代码正在运行?好吧,当我启动代码时,我首先陷入“断点 1”,当我按 F5 时,会显示确认,当我单击确认上的按钮时,我陷入“断点 2”。

此代码不起作用:

public void HandleConfirmation(Confirmation confirmation)
{
    do_Something_else(); // Breakpoint 4
    ...
}

public void Some_Other_Method(...)
{
    OwnConfirmation confirmation = ModuleManager.UnityContainer.Resolve<OwnConfirmation>();
    confirmation.Title = ...;
    objinteropts = new Inter_OwnOtherControlRequest(LocationName);
    confirmation.Content = objinteropts;
    confirmation.BackgroundColor = Colors.LightSteelBlue;

    OwnOtherControlInteractionRequest.Raise(confirmation, HandleConfirmation); // Breakpoint 3
}

我怎么知道代码不起作用?好吧,当我启动代码时,我首先陷入“断点 3”,当我按 F5 时,确认信息not 显示,我立即陷入“断点 4”。

我可以确认

OwnControlRequest
OwnOtherControlInteractionRequest
UserControl
类,所以我怀疑这两个类之间的一些差异应该导致这个问题(但也许这是完全不同的东西,我正在徒劳地追逐)。
供您参考:两个类都包含 _Loaded() 方法,如下所示:

private void <ClassName>_Loaded(object sender, RoutedEventArgs e)
{
    var result = (DataContext as <ClassName>ViewModel);
    result.LoadData(LocationName);
}

有人有想法吗?

c# wpf mvvm modal-dialog prism
1个回答
0
投票

这个问题可以关闭:问题是由相应的 XAML 文件中缺少绑定引起的:显示

Confirmation
的方法已更改,但由于它是 XAML 中绑定的一部分,因此不再找到它。

© www.soinside.com 2019 - 2024. All rights reserved.