我正在使用源自 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
类,所以我怀疑这两个类之间的一些差异应该导致这个问题(但也许这是完全不同的东西,我正在徒劳地追逐)。 private void <ClassName>_Loaded(object sender, RoutedEventArgs e)
{
var result = (DataContext as <ClassName>ViewModel);
result.LoadData(LocationName);
}
有人有想法吗?
这个问题可以关闭:问题是由相应的 XAML 文件中缺少绑定引起的:显示
Confirmation
的方法已更改,但由于它是 XAML 中绑定的一部分,因此不再找到它。