// If a DataGridCollectionViewBase is used, get the ItemProperties it defines to be able to retreive DataGridForeignKeyDescription for each of them
        // to get the auto-detected ForeignKey ItemsSource (if any).
        // If a DataGridCollectionViewBase is not used, the ItemsSource must be manually specified on each Column in order to correctly display/edit the Data
        internal static void UpdateColumnsForeignKeyConfigurationsFromDataGridCollectionView(
            ObservableColumnCollection columns,
            DataGridItemPropertyCollection itemProperties,
            bool autoCreateForeignKeyConfigurations)
        {
            if (itemProperties == null)
            {
                return;
            }

            foreach (var itemProperty in itemProperties)
            {
                var description = itemProperty.ForeignKeyDescription;
                if (description != null)
                {
                    var columnName = PropertyRouteParser.Parse(itemProperty);
                    var column     = (columnName != null) ? columns[columnName] as Column : null;

                    if (column != null)
                    {
                        ForeignKeyConfiguration.SynchronizeForeignKeyConfigurationFromForeignKeyDescription(column, description, autoCreateForeignKeyConfigurations);
                    }
                }

                if (itemProperty.ItemPropertiesInternal != null)
                {
                    ForeignKeyConfiguration.UpdateColumnsForeignKeyConfigurationsFromDataGridCollectionView(
                        columns,
                        itemProperty.ItemPropertiesInternal,
                        autoCreateForeignKeyConfigurations);
                }
            }
        }
Beispiel #2
0
            internal DeferedColumnAdditionMessageDisposable(ObservableColumnCollection columns)
            {
                if (columns == null)
                {
                    throw new ArgumentNullException("columns");
                }

                m_columns = columns;

                m_columns.m_columnAdditionMessagesDeferedCount++;
            }
        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);
            }
        }
Beispiel #5
0
 internal DeferState(ObservableColumnCollection target)
 {
     Debug.Assert(target != null);
     m_target = target;
 }
 internal static void RemoveListener(ObservableColumnCollection source, IWeakEventListener listener)
 {
     CurrentManager.ProtectedRemoveListener(source, listener);
 }
Beispiel #7
0
 internal ReadOnlyColumnCollection(ObservableColumnCollection collection)
     : base(collection)
 {
 }