internal void Add(PropertyDescriptionRoute value, bool overwrite)
        {
            PropertyDescriptionRouteDictionary.EnsureValue(value);

            var key = PropertyRouteBuilder.ToPropertyRoute(value);

            this.Add(key, value, overwrite);
        }
        internal void Add(PropertyRoute key, PropertyDescriptionRoute value, bool overwrite)
        {
            PropertyDescriptionRouteDictionary.EnsureKey(key);
            PropertyDescriptionRouteDictionary.EnsureValue(value);

            if (overwrite)
            {
                m_collection[key] = value;
            }
            else
            {
                m_collection.Add(key, value);
            }
        }
        protected DataGridDetailDescription()
        {
            m_itemProperties              = new DataGridItemPropertyCollection();
            m_detailDescriptions          = new DataGridDetailDescriptionCollection();
            m_defaultPropertyDescriptions = new PropertyDescriptionRouteDictionary();

            m_groupDescriptions = new GroupDescriptionCollection();
            m_sortDescriptions  = new DataGridSortDescriptionCollection();

            this.AutoCreateDetailDescriptions   = true;
            this.AutoCreateItemProperties       = true;
            this.DefaultCalculateDistinctValues = true;

            CollectionChangedEventManager.AddListener(m_itemProperties, this);
            InitializeItemPropertyEventManager.AddListener(m_itemProperties, this);
            CollectionChangedEventManager.AddListener(m_detailDescriptions, this);
        }
        internal static void UpdateColumnsForeignKeyConfigurations(
            ObservableColumnCollection columns,
            IEnumerable itemsSourceCollection,
            PropertyDescriptionRouteDictionary propertyDescriptions,
            bool autoCreateForeignKeyConfigurations)
        {
            var collectionViewBase = itemsSourceCollection as DataGridCollectionViewBase;

            if (collectionViewBase != null)
            {
                ForeignKeyConfiguration.UpdateColumnsForeignKeyConfigurationsFromDataGridCollectionView(columns, collectionViewBase.ItemProperties, autoCreateForeignKeyConfigurations);
            }
            else
            {
                ForeignKeyConfiguration.UpdateColumnsForeignKeyConfigurationsFromPropertyDescriptions(columns, propertyDescriptions, autoCreateForeignKeyConfigurations);
            }
        }
        private static void UpdateColumnsForeignKeyConfigurationsFromPropertyDescriptions(
            ObservableColumnCollection columns,
            PropertyDescriptionRouteDictionary propertyDescriptions,
            bool autoCreateForeignKeyConfigurations)
        {
            if ((columns == null) || (propertyDescriptions == null))
            {
                return;
            }

            foreach (var column in columns)
            {
                var targetColumn = column as Column;
                if (targetColumn == null)
                {
                    continue;
                }

                var key = PropertyRouteParser.Parse(targetColumn.FieldName);
                if (key == null)
                {
                    continue;
                }

                var propertyDescription = propertyDescriptions[key];
                if (propertyDescription == null)
                {
                    continue;
                }

                var foreignKeyDescription = propertyDescription.Current.ForeignKeyDescription;
                if (foreignKeyDescription == null)
                {
                    continue;
                }

                ForeignKeyConfiguration.SynchronizeForeignKeyConfigurationFromForeignKeyDescription(targetColumn, foreignKeyDescription, autoCreateForeignKeyConfigurations);
            }
        }
        internal bool TryGetValue(PropertyRoute key, out PropertyDescriptionRoute value)
        {
            PropertyDescriptionRouteDictionary.EnsureKey(key);

            return(m_collection.TryGetValue(key, out value));
        }
        internal void Remove(PropertyRoute key)
        {
            PropertyDescriptionRouteDictionary.EnsureKey(key);

            m_collection.Remove(key);
        }