protected void SyncSectionsToColumns(HeaderColumnSection.DisplayMode displayModeToCreate)
        {
            List <HeaderColumnSection> newHeaderList = new List <HeaderColumnSection>();
            Dictionary <Column, HeaderColumnSection> columnToHeaderColumnSection = new Dictionary <Column, HeaderColumnSection>();

            foreach (Section s in Children)
            {
                HeaderColumnSection headerColumnSection = s as HeaderColumnSection;

                if (headerColumnSection != null)
                {
                    columnToHeaderColumnSection[headerColumnSection.Column] = headerColumnSection;
                }
            }

            //
            // Add  additions
            foreach (Column column in _columns)
            {
                HeaderColumnSection headerColumnSection;

                if (!columnToHeaderColumnSection.TryGetValue(column, out headerColumnSection))
                {
                    headerColumnSection = CreateHeaderColumnSection(displayModeToCreate, column);
                }
                newHeaderList.Add(headerColumnSection);
            }

            //
            // Remove any ones that doesn't exists any more
            foreach (Section s in Children)
            {
                HeaderColumnSection hcs = s as HeaderColumnSection;

                if (hcs != null)
                {
                    if (newHeaderList.IndexOf(hcs) == -1)
                    {
                        hcs.Dispose();
                    }
                }
            }

            Children.Clear();
            Children.AddRange(newHeaderList.ToArray());
        }
Beispiel #2
0
 protected override HeaderColumnSection CreateHeaderColumnSection(HeaderColumnSection.DisplayMode displayModeToCreate, Column column)
 {
     return(Host.SectionFactory.CreateAvailableColumnSection(Host, column));
 }
 protected virtual HeaderColumnSection CreateHeaderColumnSection(HeaderColumnSection.DisplayMode displayModeToCreate, Column column)
 {
     return(Host.SectionFactory.CreateHeaderColumnSection(Host, displayModeToCreate, column));
 }
Beispiel #4
0
 public virtual HeaderColumnSection CreateHeaderColumnSection(ISectionHost host, HeaderColumnSection.DisplayMode displayMode, Column column)
 {
     return(new HeaderColumnSection(host, displayMode, column));
 }