1

I am in midway implementing an UndoRedo container for a view model that contains nested properties and ObservableCollection. I am using PostSharp for Exception Handling in the application and thought of reusing it for implementing an undo-redo engine as stated in the article: http://www.postsharp.net/aspects/examples/undoredo

Although the above article is for windowsForms which had binding limitations, I have made the engine to adopt the rich binding wpf platform and it is working nice for single properties.

I am wondering how to extend the UndoableAttribute to take care of Nested properties and collections. My tries and googling skills have proved futile till now. Any idea, or pointer to some article would be appreciated.

4

1 回答 1

0

这真的取决于你所追求的。在对象图上提供撤消功能可能是一项相当复杂的任务。您必须更具体地说明您想要实现的目标。

通常,您可以检测所有嵌套对象并编写一些专门的集合以将所有更改存储在某种全局容器中。

我们正在努力提供这样的功能,作为 PostSharp.Patterns 库未来版本的一部分——它应该适用于 3.1 或 3.2。

于 2013-03-29T13:42:17.653 回答