本文介绍了单击CancelBtn取消更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的程序自定义属性网格中,所有属性都可以从viewModel绑定。在这个属性网格中还有2个按钮--SaveBtn和EditBtn。 用户编辑属性网格中的属性。单击SaveBtn时,所有属性都必须保存在数据库中。如果用户想要编辑属性,则单击EditBtn,然后在将属性保存到数据库(单击SaveBtn)之前,应该出现新窗口,其中用户选择修改属性的原因。在该窗口上还有三个按钮 - ExitWithSavingToDatabase,ExitWithoutSavingToDatabase和Cancel。



如果用户选择取消,则应取消所有更改。但是viewModel中的属性已经有了新值。 我的问题是 - 如何将属性重置为旧值? 我正在考虑从数据库重新加载属性,但是如果有更好的解决方案,我可以在不使用数据库的情况下完成它?

解决方案

I have in my program custom property grid, where all properties are bindable from viewModel. In this property grid there are also 2 buttons - SaveBtn and EditBtn. User edit properties in property grid. When SaveBtn is clicked, all properties must be saved in a database. If user wants to edit properties, he clicks EditBtn and then before saving properties to database(SaveBtn is clicked), should appear new window, where user chooses a reason of modification of a properties. On that window there are also three buttons - ExitWithSavingToDatabase, ExitWithoutSavingToDatabase and Cancel.

If user chooses Cancel, all changes should be canceled. But properties in viewModel already have new values. My question is - how can I reset properties to old values??? I was thinking of reloading properties from database, but if there is a better solution, where I can do it without using database?

解决方案


这篇关于单击CancelBtn取消更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 05:44