IEditableCollectionView.CancelEdit 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
结束编辑事务,并尽可能将原始值还原到项。
public:
void CancelEdit();
public void CancelEdit();
abstract member CancelEdit : unit -> unit
Public Sub CancelEdit ()
示例
以下示例将检查 CanCancelEdit 编辑项的原始值是否可以在调用 CancelEdit之前还原。 如果无法还原这些值,则必须提供其他逻辑来执行此操作。 如果可以,则当示例调用 CancelEdit时,值将还原。 有关整个示例,请参阅 使用 IEditableCollectionView 示例更改集合。
// If the objects in the collection can discard pending
// changes, calling IEditableCollectionView.CancelEdit
// will revert the changes. Otherwise, you must provide
// your own logic to revert the changes in the object.
if (!editableCollectionView.CanCancelEdit)
{
// Provide logic to revert changes.
}
editableCollectionView.CancelEdit();
' If the objects in the collection can discard pending
' changes, calling IEditableCollectionView.CancelEdit
' will revert the changes. Otherwise, you must provide
' your own logic to revert the changes in the object.
If Not editableCollectionView.CanCancelEdit Then
' Provide logic to revert changes.
End If
editableCollectionView.CancelEdit()
注解
CancelEdit
CurrentEditItem设置为null集合视图并导致集合视图退出编辑状态。
CanCancelEdit如果是true,CancelEdit则还会还原已编辑对象的原始值。