我的 C# WPF MVVM 应用程序中有以下代码。
public RelayCommand PolishCommand
{
get
{
polishcommand = new RelayCommand(e =>
{
PolishedWeightCalculatorViewModel model = new PolishedWeightCalculatorViewModel(outcomeIndex, OutcomeSelectedItem.RoughCarats);
PolishedWeightCalculatorView polish = new PolishedWeightCalculatorView(model);
bool? result = polish.ShowDialog();
if (result.HasValue)
{
但我开始知道,从视图模型调用窗口在 MVVM 模式中是错误的。
在下面的链接中也有说明。
MV-VM 设计问题。从 ViewModel 调用 View
请通过提供替代解决方案来帮助我。
提前致谢。