/// <summary>
        /// Gets the groups of columns - grouped by <see cref="SetGroup(DataColumn, string)"/>
        /// </summary>
        /// <param name="table">The table.</param>
        /// <returns></returns>
        public static ColumnGroups getGroupsOfColumns(this DataTable table)
        {
            Dictionary <String, DataColumn> registry = new Dictionary <string, DataColumn>();

            ColumnGroups groups = new ColumnGroups();
            ColumnGroup  group  = new ColumnGroup();

            Boolean startOfTheGroup = false;
            String  lastKey         = "";

            foreach (DataColumn c in table.Columns)
            {
                String key = c.GetGroup().ToUpper();

                if (lastKey != "" && lastKey != key)
                {
                    startOfTheGroup = true;
                }

                if (startOfTheGroup)
                {
                    if (group.Any())
                    {
                        groups.Add(group);
                    }
                    group           = new ColumnGroup();
                    startOfTheGroup = false;
                }

                group.Add(c);

                lastKey = key;
            }
            groups.Add(group);

            return(groups);
        }
예제 #2
0
 public void ChildAdd(object o)
 {
     ColumnGroups.Add(o as ColumnGroup);
 }
예제 #3
0
 public void AddColumns(GridViewColumnGroup col)
 {
     ColumnGroups.Add(col);
 }
예제 #4
0
        //If the user selects a column option.  We need to perform the operation
        private void optionCtrl_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var optionCtrl = sender as ColumnOptionControl;

            if (e.PropertyName == "SelectedColumnOptionItem")
            {
                if (optionCtrl != null)
                {
                    switch (optionCtrl.SelectedColumnOptionItem.ColumnOption)
                    {
                    case Enums.ColumnOption.AddGrouping:
                        optionCtrl.IsGrouped = true;
                        var v = new PagedCollectionView(FilteredItemsSource);

                        var newGroup = new PropertyGroupDescription(optionCtrl.FilterColumnInfo.PropertyPath, optionCtrl.FilterColumnInfo.Converter);
                        ColumnGroups.Add(newGroup);

                        foreach (var item in ColumnGroups)
                        {
                            v.GroupDescriptions.Add(item);
                        }

                        ItemsSource = v;
                        break;

                    case Enums.ColumnOption.RemoveGrouping:
                        optionCtrl.IsGrouped = false;
                        var view  = new PagedCollectionView(FilteredItemsSource);
                        var group = ColumnGroups.FirstOrDefault(c => c.PropertyName == optionCtrl.FilterColumnInfo.PropertyPath);
                        if (@group != null)
                        {
                            ColumnGroups.Remove(@group);
                        }
                        foreach (var item in ColumnGroups)
                        {
                            view.GroupDescriptions.Add(item);
                        }
                        ItemsSource = view;
                        break;

                    case Enums.ColumnOption.PinColumn:
                        optionCtrl.IsPinned = true;
                        var frozenCount = FrozenColumnCount;
                        if (optionCtrl.Column.DisplayIndex >= FrozenColumnCount)
                        {
                            frozenCount++;
                        }
                        optionCtrl.Column.DisplayIndex = 0;
                        FrozenColumnCount = frozenCount;
                        break;

                    case Enums.ColumnOption.UnpinColumn:
                        optionCtrl.IsPinned = false;
                        if (FrozenColumnCount == 0)
                        {
                            FrozenColumnCount = 1;
                        }
                        optionCtrl.Column.DisplayIndex = FrozenColumnCount - 1;
                        FrozenColumnCount = FrozenColumnCount - 1;
                        break;
                    }
                }
            }
        }
예제 #5
0
 /// ------------------------------------------------------------------------------------
 public void AddColumnGroup(string text, string textsLocalizationId)
 {
     ColumnGroups.Add(CVChartColumnGroup.Create(text, this, textsLocalizationId));
 }