本文整理匯總了C#中System.ComponentModel.IEditableCollectionView.EditItem方法的典型用法代碼示例。如果您正苦於以下問題:C# IEditableCollectionView.EditItem方法的具體用法?C# IEditableCollectionView.EditItem怎麽用?C# IEditableCollectionView.EditItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.ComponentModel.IEditableCollectionView
的用法示例。
在下文中一共展示了IEditableCollectionView.EditItem方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ChangeItemWindow
IEditableCollectionView editableCollectionView =
itemsControl.Items as IEditableCollectionView;
// Create a window that prompts the user to edit an item.
ChangeItemWindow win = new ChangeItemWindow();
editableCollectionView.EditItem(itemsControl.SelectedItem);
win.DataContext = itemsControl.SelectedItem;
// If the user submits the new item, commit the changes.
// If the user cancels the edits, discard the changes.
if ((bool)win.ShowDialog())
{
editableCollectionView.CommitEdit();
}
else
{
// 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();
}