private static void propertyGrid_PropertyValueChanged(object sender,
                                                              PropertyValueChangedEventArgs e)
        {
            PropertyGrid   grid           = sender as PropertyGrid;
            CollectionForm collectionForm = (CollectionForm)grid.Parent.Parent;

            NamedCollection <T> items           = collectionForm.EditValue as NamedCollection <T>;
            GridItem            changedGridItem = e.ChangedItem;

            while (changedGridItem.GridItemType != GridItemType.Root)
            {
                changedGridItem = changedGridItem.Parent;
            }

            T changedItem = (T)changedGridItem.Value;

            if (e.ChangedItem.PropertyDescriptor.Name == "Name")
            {
                foreach (T item in items)
                {
                    if (item.Equals(changedItem))
                    {
                        continue;
                    }

                    if (String.Equals(item.Name, changedItem.Name))
                    {
                        changedItem.Name = e.OldValue as string;
                    }
                }
            }
        }
 public NamedCollectionPropertyDescriptor(NamedCollection <T> collection, int index)
     : base("#" + index.ToString(), null)
 {
     this._collection = collection;
     this._index      = index;
 }
 public UserAccessSettings()
 {
     Users = new NamedCollection <User>();
 }