"Stateful" 在 MVVM 的 Stateful ViewModel 中意味着什么

What does "Stateful" means in Stateful ViewModel in MVVM

我正在阅读一些 XAML 模式,还有状态视图模型,根据我的阅读,它与我们所说的“ViewModel”没有什么不同。

这里有一个例子的描述:

Stateful View Model:

To create isolation between business logic and presentation, data should be removed from the view. The stateful view model pattern moves data into the view model using XAML data binding. This allows the view model to be tested without constructing a view, and it allows the view to change with minimal impact on the business logic.

Stateful ViewModel 有什么特别之处?为什么不叫 ViewModel

Link : http://www.xamlpatterns.com/stateful-view-model

在我看来,有状态 VM 表示 "stateful" 可以在视图生命周期内更改的对象,甚至可以在下一个视图实例使用完全相同的 VM 时比它更长寿。此外,它可以有各种视图切换、根据当前数据事实的情况等。虽然基本 VM 会在短时间内重复数据载体,例如显示 DB 结果列表或用作表单字段容器,绑定到看法。因此,无论何时完成视图操作,都不再需要视图模型。

现在关于您发布的定义,它对有状态和无状态的定义完全相同。