本文整理匯總了C#中System.ComponentModel.IEditableCollectionView接口的典型用法代碼示例。如果您正苦於以下問題:C# IEditableCollectionView接口的具體用法?C# IEditableCollectionView怎麽用?C# IEditableCollectionView使用的例子?那麽, 這裏精選的接口代碼示例或許可以為您提供幫助。
IEditableCollectionView接口屬於System.ComponentModel命名空間,在下文中一共展示了IEditableCollectionView接口的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ChangeItemWindow
IEditableCollectionView editableCollectionView =
itemsControl.Items as IEditableCollectionView;
if (!editableCollectionView.CanAddNew)
{
MessageBox.Show("You cannot add items to the list.");
return;
}
// Create a window that prompts the user to enter a new
// item to sell.
ChangeItemWindow win = new ChangeItemWindow();
//Create a new item to be added to the collection.
win.DataContext = editableCollectionView.AddNew();
// If the user submits the new item, commit the new
// object to the collection. If the user cancels
// adding the new item, discard the new item.
if ((bool)win.ShowDialog())
{
editableCollectionView.CommitNew();
}
else
{
editableCollectionView.CancelNew();
}