private static List<DataGridDetailDescription> GetDataGridDetailDescriptions( PropertyDescriptorCollection properties )
    {
      Type enumrableType = typeof( IEnumerable );
      Type listSourceType = typeof( IListSource );

      List<DataGridDetailDescription> detailDescriptions = new List<DataGridDetailDescription>( properties.Count );

      foreach( PropertyDescriptor property in properties )
      {
        // We only create details for properties that are browsable.
        if( !property.IsBrowsable )
          continue;

        if( ItemsSourceHelper.IsASubRelationship( property.PropertyType ) )
        {
          PropertyDetailDescription description = new PropertyDetailDescription( property );
          description.IsAutoCreated = true;
          detailDescriptions.Add( description );
        }
      }

      return detailDescriptions;
    }
        protected internal override void Initialize(DataGridCollectionViewBase parentCollectionView)
        {
            base.Initialize(parentCollectionView);

            if (this.PropertyDescriptor != null)
            {
                return;
            }

            string relationName = this.RelationName;

            if (String.IsNullOrEmpty(relationName) == true)
            {
                throw new InvalidOperationException("An attempt was made to initialize a PropertyDetailDescription whose Name property has not been set.");
            }

            foreach (DataGridDetailDescription detailDescription in parentCollectionView.DetailDescriptions.DefaultDetailDescriptions)
            {
                PropertyDetailDescription propertyDetailDescription = detailDescription as PropertyDetailDescription;
                if (propertyDetailDescription != null)
                {
                    if (propertyDetailDescription.RelationName == relationName)
                    {
                        this.PropertyDescriptor = propertyDetailDescription.PropertyDescriptor;
                        return;
                    }
                }
            }

            // The DetailDescription for RelationName was not found in DefaultDetailDescription
            // and may not have the PropertyDetailDescriptionAttribute
            if (this.PropertyDescriptor == null)
            {
                PropertyDescriptor relationDescriptor = null;

                IEnumerable enumeration = parentCollectionView as IEnumerable;

                if (enumeration != null)
                {
                    // Try to get it from the first item in the DataGridCollectionView
                    object firstItem = ItemsSourceHelper.GetFirstItemByEnumerable(enumeration);

                    if (firstItem != null)
                    {
                        relationDescriptor = this.GetPropertyDescriptorFromFirstItem(firstItem);

                        if (relationDescriptor != null)
                        {
                            this.PropertyDescriptor = relationDescriptor;
                            return;
                        }
                    }
                }

                // If the list is empty, check if the SourceCollection is ITypedList
                ITypedList iTypedList = parentCollectionView.SourceCollection as ITypedList;

                if (iTypedList != null)
                {
                    relationDescriptor = this.GetPropertyDescriptorFromITypedList(iTypedList);

                    if (relationDescriptor != null)
                    {
                        this.PropertyDescriptor = relationDescriptor;
                        return;
                    }
                }
            }

            throw new InvalidOperationException("An attempt was made to initialize a PropertyDetailDescription whose data source does not contain a property that corresponds to the specified relation name.");
        }