private static bool HasGroup( DetailConfigurationCollection configurations )
    {
      bool returnValue = false;

      int detailConfigurationCount = configurations.Count;

      for( int i = 0; i < detailConfigurationCount; i++ )
      {
        DetailConfiguration detailConfiguration = configurations[ i ];

        if( detailConfiguration.DetailConfigurations != null )
          returnValue = GroupingHelper.HasGroup( detailConfiguration.DetailConfigurations );

        if( returnValue )
          break;

        returnValue = ( detailConfiguration.GroupLevelDescriptions.Count > 0 );

        if( returnValue )
          break;
      }

      return returnValue;
    }
Пример #2
0
 private void SetDetailConfigurations( DetailConfigurationCollection value )
 {
   this.SetValue( DetailConfiguration.DetailConfigurationsPropertyKey, value );
 }
Пример #3
0
    internal static void CleanupDetailConfigurations( DetailConfigurationCollection detailConfigurationCollection, bool autoRemoveUnassociated )
    {
      for( int i = detailConfigurationCollection.Count - 1; i >= 0; i-- )
      {
        DetailConfiguration detailConfiguration = detailConfigurationCollection[ i ];
        detailConfiguration.DetachFromDetailDescription();
        DetailConfiguration.CleanupDetailConfigurations( detailConfiguration.DetailConfigurations, autoRemoveUnassociated );

        if( ( detailConfiguration.IsAutoCreated ) && ( autoRemoveUnassociated ) )
        {
          detailConfigurationCollection.RemoveAt( i );
        }
      }
    }
Пример #4
0
    internal static void SynchronizeDetailConfigurations(
      DataGridDetailDescriptionCollection dataGridDetailDescriptionCollection,
      DetailConfigurationCollection detailConfigurationCollection,
      bool autoCreateDetailConfigurations,
      bool autoCreateForeignKeyConfigurations,
      bool autoRemoveUnassociated )
    {
      HashSet<DetailConfiguration> detailConfigWithAssociation = new HashSet<DetailConfiguration>();
      DetailConfiguration detailConfig;

      foreach( DataGridDetailDescription detailDescription in dataGridDetailDescriptionCollection )
      {
        detailConfig = detailConfigurationCollection[ detailDescription.RelationName ];

        if( detailConfig == null )
        {
          if( autoCreateDetailConfigurations )
          {
            detailConfig = new DetailConfiguration();

            detailConfig.SetIsAutoCreated( true );
            detailConfig.RelationName = detailDescription.RelationName;
            detailConfig.AutoCreateForeignKeyConfigurations = autoCreateForeignKeyConfigurations;
            detailConfig.AutoRemoveColumnsAndDetailConfigurations = autoRemoveUnassociated;
            detailConfigurationCollection.Add( detailConfig );
          }
        }

        if( detailConfig != null )
        {
          detailConfigWithAssociation.Add( detailConfig );
          detailConfig.SynchronizeWithDetailDescription( detailDescription );
        }
      }

      for( int i = detailConfigurationCollection.Count - 1; i >= 0; i-- )
      {
        detailConfig = detailConfigurationCollection[ i ];

        if( !detailConfigWithAssociation.Contains( detailConfig ) )
        {
          detailConfig.DetachFromDetailDescription();

          if( ( autoRemoveUnassociated ) && ( detailConfig.IsAutoCreated ) )
          {
            DetailConfiguration.CleanupDetailConfigurations( detailConfig.DetailConfigurations, autoRemoveUnassociated );
            detailConfigurationCollection.RemoveAt( i );
          }
        }
      }
    }
Пример #5
0
    internal void AttachToContainingCollection( DetailConfigurationCollection detailConfigurationCollection )
    {
      if( m_containingCollection == detailConfigurationCollection )
        return;

      Debug.Assert( detailConfigurationCollection != null, "For clarity purposes, you should use Detach in this context... or remove this assert." );

      if( detailConfigurationCollection == null )
      {
        this.DetachFromContainingCollection();
      }
      else
      {
        m_containingCollection = detailConfigurationCollection;

        if( this.Columns != null )
          this.Columns.DataGridControl = this.DataGridControl;

        if( this.DetailConfigurations != null )
          this.DetailConfigurations.DataGridControl = this.DataGridControl;
      }
    }
Пример #6
0
 internal void SetDetailConfigurations( DetailConfigurationCollection value )
 {
   this.SetValue( DataGridControl.DetailConfigurationsPropertyKey, value );
 }
        protected override List <AutomationPeer> GetChildrenCore()
        {
            DataRow dataRow = m_dataGridContext.CustomItemContainerGenerator.ContainerFromItem(m_item) as DataRow;

            if (dataRow == null)
            {
                return(null);
            }

            // Get child context ( Detail )
            DetailConfigurationCollection detailConfigurations = m_dataGridContext.DetailConfigurations;
            int detailConfigurationsCount = detailConfigurations.Count;

            ReadOnlyObservableCollection <ColumnBase> visibleColumns = m_dataGridContext.VisibleColumns;
            int visibleColumnsCount = visibleColumns.Count;

            if (visibleColumnsCount + detailConfigurationsCount <= 0)
            {
                return(null);
            }

            Hashtable             oldDataChildren = m_dataChildren;
            List <AutomationPeer> list            = new List <AutomationPeer>(visibleColumnsCount + detailConfigurationsCount);

            m_dataChildren = new Hashtable(visibleColumnsCount + detailConfigurationsCount);

            for (int i = 0; i < visibleColumnsCount; i++)
            {
                ColumnBase column = visibleColumns[i];

                DataGridItemCellAutomationPeer cellAutomationPeer =
                    oldDataChildren[column] as DataGridItemCellAutomationPeer;

                if (cellAutomationPeer == null)
                {
                    cellAutomationPeer = new DataGridItemCellAutomationPeer(this, column);
                }

                // Always resetting the ColumnIndex since the visible position can have changed
                cellAutomationPeer.ColumnIndex = i;

                list.Add(cellAutomationPeer);
                m_dataChildren[column] = cellAutomationPeer;
            }

            for (int i = 0; i < detailConfigurationsCount; i++)
            {
                DetailConfiguration           detailConfiguration = detailConfigurations[i];
                DataGridContextAutomationPeer detailDataGridContextAutomationPeer = null;

                detailDataGridContextAutomationPeer =
                    oldDataChildren[detailConfiguration] as DataGridContextAutomationPeer;

                if (detailDataGridContextAutomationPeer == null)
                {
                    detailDataGridContextAutomationPeer = new DataGridContextAutomationPeer(
                        m_dataGridContext.DataGridControl, m_dataGridContext, m_item, detailConfiguration);
                }

                list.Add(detailDataGridContextAutomationPeer);
                m_dataChildren[detailConfiguration] = detailDataGridContextAutomationPeer;
            }

            return(list);
        }
    internal void AttachToContainingCollection( DetailConfigurationCollection detailConfigurationCollection )
    {
      if( detailConfigurationCollection == null )
        throw new ArgumentNullException( "detailConfigurationCollection" );

      this.ContainingCollection = detailConfigurationCollection;
    }