0

I have a small gui with a listbox. The listbox is bound to a collection. The user can edit an item in the collection using an "Edit" window.

The Edit window is bound to the selected object in the listbox. One of the validations I need to perform is to make sure the user does not enter a name for an item which has already been used (meaning it can't be used by any of the other objects in the listbox).

Is there a good way to do this with WPF validation?

4

1 回答 1

1

您正在验证的项目必须提供对父对象(集合)的引用。当你有父集合时,剩下的很简单,我认为,与 WPF 无关。

看看C# 和 .Net 中的 Enforcing parent-child 关系

于 2012-06-08T20:32:46.740 回答