Beispiel #1
0
        internal GridSetting GetResetGridConfig()
        {
            GridSetting gridConfig = new GridSetting()
            {
                Name                     = RESET_NAME,
                PageSize                 = this.OwningGrid.PageSize,
                GridGuid                 = this.OwningGrid.GridID,
                RowHeight                = this.OwningGrid.RowHeight,
                RowBackground            = TransFormColorToUint(this.OwningGrid.RowBackground),
                AlternatingRowBackground = TransFormColorToUint(this.OwningGrid.AlternatingRowBackground),
                Columns                  = new System.Collections.Generic.List <GridColumn>()
            };

            if (this.OwningGrid.NeedStoreColumns || this.OwningGrid.EnableCustomizeColumn)
            {
                foreach (var col in this.OwningGrid.Columns)
                {
                    var colName   = col.GetColumnName();
                    var colConfig = new GridColumn()
                    {
                        Index       = col.DisplayIndex,
                        IsFreezed   = false,
                        IsHided     = false,
                        Name        = colName,
                        Width       = col.Width,
                        ActualWidth = col.ActualWidth == 20 ? 100 : col.ActualWidth
                    };

                    gridConfig.Columns.Add(colConfig);
                }
            }
            return(gridConfig);
        }
Beispiel #2
0
        internal void ApplyColumns(GridSetting currentConfig)
        {
            if (!this.OwningGrid.m_customizeDialog.IsEnableCustomizeColumn())
            {
                return;
            }
            if (currentConfig.Columns != null)
            {
                foreach (var col in this.OwningGrid.Columns)
                {
                    var name = Extensions.GetColumnName(col);
                    var c    = currentConfig.Columns.FirstOrDefault(p => string.Equals(name, p.Name, StringComparison.OrdinalIgnoreCase));

                    if (c != null)
                    {
                        col.DisplayIndex = c.Index;
                        if (c.ActualWidth > 20)
                        {
                            col.Width = new DataGridLength(c.ActualWidth);
                        }
                        col.Visibility = c.IsHided ? Visibility.Collapsed : Visibility.Visible;
                    }
                }
            }
        }
Beispiel #3
0
        GridSetting GetConfig()
        {
            var config = new GridSetting();

            config.GridGuid = this.OwningGrid.GridID;
            config.Name     = this.m_txtName.Text.Trim();
            config.PageSize = int.Parse((this.m_cmbPageSize.SelectedItem as ComboBoxItem).Content.ToString());
            if (string.IsNullOrEmpty(config.Name))
            {
                throw new ArgumentException(Resource.Name_Required);
            }
            config.IsDefault = this.m_chkDefault.IsChecked.Value;
            config.Columns   = new List <GridColumn>();
            if (this.m_selectedColumnsListBox.Items.Count > 0)
            {
                foreach (var item in this.m_selectedColumnsListBox.Items)
                {
                    var        listBoxItem = item as ListBoxItemExt;
                    GridColumn col         = new GridColumn()
                    {
                        Index   = this.m_selectedColumnsListBox.Items.IndexOf(listBoxItem),
                        IsHided = false,
                        Name    = listBoxItem.Name.Replace(ListBoxItemNamePrefix, ""),
                        Width   = new DataGridLength(listBoxItem.ColWidth)
                    };
                    config.Columns.Add(col);
                }
            }
            else
            {
                throw new ArgumentException(Resource.ColumnsV2_AtLeastSelectOneColumn);;
            }
            if (this.m_availableColumnsListBox.Items.Count > 0)
            {
                foreach (var item in this.m_availableColumnsListBox.Items)
                {
                    var        listBoxItem = item as ListBoxItemExt;
                    GridColumn col         = new GridColumn()
                    {
                        Index   = 0,//不显示,没有意义
                        IsHided = true,
                        Name    = listBoxItem.Name.Replace(ListBoxItemNamePrefix, ""),
                        Width   = new DataGridLength(listBoxItem.ColWidth)
                    };
                    config.Columns.Add(col);
                }
            }
            return(config);
        }
Beispiel #4
0
        /// <summary>
        /// Set Column's width, dispaly index and visibility
        /// </summary>
        /// <param name="currentConfig"></param>
        internal void ApplyConfig(GridSetting currentConfig)
        {
            this.OwningGrid.RowBackground            = TransformUintToColor(currentConfig.RowBackground);
            this.OwningGrid.AlternatingRowBackground = TransformUintToColor(currentConfig.AlternatingRowBackground);

            if (this.OwningGrid.ActualRowHeight <= currentConfig.RowHeight && !this.OwningGrid.DisableProfileRowHeight)
            {
                this.OwningGrid.RowHeight = currentConfig.RowHeight;
            }
            this._rowHeightInput.Value = currentConfig.RowHeight.CompareTo(double.NaN) == 0 ? this._rowHeightInput.Minimum : currentConfig.RowHeight;

            if (this.OwningGrid.IsShowPager)
            {
                var item = this._cmbPageSize.Items.SingleOrDefault(i => int.Parse(((ComboBoxItem)i).Tag.ToString()) == currentConfig.PageSize);
                if (item != null)
                {
                    this._cmbPageSize.SelectedItem = item;
                }
            }


            foreach (var colorItem in _backgroundColorPicker.Items)
            {
                var color = colorItem as ColorDescription;
                if (color.ColorCode == currentConfig.RowBackground)
                {
                    var index = _backgroundColorPicker.Items.IndexOf(colorItem);
                    _backgroundColorPicker.SelectedIndex = index;
                }
            }
            foreach (var colorItem in _bandedColorPicker.Items)
            {
                var color = colorItem as ColorDescription;
                if (color.ColorCode == currentConfig.AlternatingRowBackground)
                {
                    var index = _bandedColorPicker.Items.IndexOf(colorItem);
                    _bandedColorPicker.SelectedIndex = index;
                }
            }

            if (this.OwningGrid.NeedStoreColumns || this.OwningGrid.EnableCustomizeColumn)
            {
                ApplyColumns(currentConfig);
            }
        }
Beispiel #5
0
        public override void OnApplyTemplate()
        {
            this._elementRoot         = GetTemplateChild(RootElementName) as FrameworkElement;
            this._gridSettingsListBox = GetTemplateChild(ElementGridSettingsListBoxName) as ListBox;

            this._configButton = GetTemplateChild(ElementConfigButtonName) as HyperlinkButton;
            if (this._configButton != null)
            {
                _configButton.Content     = Resource.ColumnsV2_ColumnOptions;
                this._configButton.Click += new RoutedEventHandler(_configButton_Click);
            }

            base.OnApplyTemplate();

            this._gridSettingsListBox.DisplayMemberPath = "Name";
            this._gridSettingsListBox.SelectionChanged += new SelectionChangedEventHandler(_gridSettingsListBox_SelectionChanged);
            this._gridSettingsListBox.ItemsSource       = m_settingsCollection;

            this.m_resetGridConfig = this.OwningGrid.m_resetGridConfig;

            RefreshGridConfig(false);
        }
Beispiel #6
0
        /// <summary>
        /// Refresh Grid Config
        /// </summary>
        /// <param name="flag">是否需要设置Column的状态</param>
        void RefreshGridConfig(bool flag)
        {
            GridSetting currentConfig = null;

            m_settingsCollection.Clear();
            //增加初始设置
            var resetItem = new ListBoxItem {
                Content = Resource.ColumnsV3_Reset, Name = RESET_NAME
            };

            m_settingsCollection.Insert(0, resetItem);

            if (this.OwningGrid.GridSettings != null)
            {
                var reset = this.OwningGrid.GridSettings.FirstOrDefault(p => p.Name == RESET_NAME);
                if (reset != null)
                {
                    this.OwningGrid.GridSettings.Remove(reset);
                }

                this.OwningGrid.GridSettings.ForEach(p =>
                {
                    var item = new ListBoxItem {
                        Content = p.Name
                    };
                    if (p.IsDefault)
                    {
                        item.Content = string.Format("{0}{1}", Default_Prefix, p.Name);
                    }
                    if (p.Name != RESET_NAME)
                    {
                        m_settingsCollection.Insert(1, item);
                    }
                });
            }

            if (this.OwningGrid.GridSettings != null && this.OwningGrid.GridSettings.Count > 0)
            {
                var defaultConfig = this.OwningGrid.GridSettings.FirstOrDefault(p => p.IsDefault);
                if (defaultConfig == null)
                {
                    currentConfig = this.OwningGrid.GridSettings[0];
                }
                else
                {
                    currentConfig = defaultConfig;
                }

                foreach (var item in this._gridSettingsListBox.Items)
                {
                    if ((item as ListBoxItem).Content.ToString().Replace(Default_Prefix, "") == currentConfig.Name)
                    {
                        var index = m_settingsCollection.IndexOf((item as ListBoxItem));
                        this._gridSettingsListBox.SelectedIndex = index;
                        break;
                    }
                }

                if (flag)
                {
                    this.OwningSelector.ApplyConfig(currentConfig);
                }
            }
            else
            {
                if (flag)
                {
                    this.OwningSelector.ApplyConfig(m_resetGridConfig);
                }
                this._gridSettingsListBox.SelectedIndex = 0;
            }
        }
Beispiel #7
0
        internal void SaveConfig(bool isStoreColumns)
        {
            var name = this.OwningGrid.GridID;

            if (string.IsNullOrEmpty(name))
            {
                return;
            }
            GridSetting config = null;

            if (this.OwningGrid.GridSettings != null)
            {
                config = this.OwningGrid.GridSettings.FirstOrDefault(p => p.IsDefault);
            }
            else
            {
                this.OwningGrid.GridSettings = new List <GridSetting>();
            }

            if (this.OwningGrid.IsShowColumnsSelector)
            {
                if (this.OwningGrid.ActualRowHeight <= _rowHeightInput.Value && !this.OwningGrid.DisableProfileRowHeight)
                {
                    this.OwningGrid.RowHeight = _rowHeightInput.Value;
                }
            }

            if (config == null)
            {
                config = new GridSetting
                {
                    GridGuid                 = this.OwningGrid.GridID,
                    Name                     = "Default Setting",
                    PageSize                 = this.OwningGrid.PageSize,
                    IsDefault                = true,
                    RowHeight                = this.OwningGrid.IsShowColumnsSelector ? _rowHeightInput.Value : this.OwningGrid.RowHeight,
                    RowBackground            = TransFormColorToUint(this.OwningGrid.RowBackground),
                    AlternatingRowBackground = TransFormColorToUint(this.OwningGrid.AlternatingRowBackground),
                    Columns                  = GetColumns()
                };
            }
            else
            {
                config.PageSize                 = this.OwningGrid.PageSize;
                config.RowHeight                = this.OwningGrid.IsShowColumnsSelector ? _rowHeightInput.Value : this.OwningGrid.RowHeight;
                config.RowBackground            = TransFormColorToUint(this.OwningGrid.RowBackground);
                config.AlternatingRowBackground = TransFormColorToUint(this.OwningGrid.AlternatingRowBackground);
                if (isStoreColumns)
                {
                    config.Columns = GetColumns();
                }
            }

            var result = this.OwningGrid.GridSettings.FirstOrDefault(p => p.Name == config.Name);

            if (result == null)
            {
                this.OwningGrid.GridSettings.Insert(0, config);
            }
            else
            {
                var index = this.OwningGrid.GridSettings.IndexOf(result);
                this.OwningGrid.GridSettings[index] = config;
            }

            var allSettings = this.OwningGrid.AllGridSettings;

            this.OwningGrid.GridSettings.ForEach(p =>
            {
                var item = allSettings.FirstOrDefault(k => k.GridGuid == this.OwningGrid.GridID && k.Name == p.Name);
                allSettings.Remove(item);
            });

            this.OwningGrid.GridSettings.ForEach(p =>
            {
                allSettings.Add(p);
            });

            this.OwningGrid.m_userProfile.Set(GridKeys.KEY_UP_GRIDSETTINGS, allSettings, true);

            if (this.OwningGrid.IsShowColumnsSelector)
            {
                m_settingsCollection.Insert(0, new ComboBoxItem {
                    Content = config.Name
                });
                if (this.OwningGrid.AllGridSettings.Count > 0)
                {
                    this._deleteButton.IsEnabled = true;
                }
            }
        }
Beispiel #8
0
        internal void RefreshGridConfig(bool flag)
        {
            GridSetting currentConfig = null;

            m_settingsCollection.Clear();
            //增加初始设置
            var resetItem = new ComboBoxItem {
                Content = Resource.ColumnsV3_Reset, Name = RESET_NAME
            };

            m_settingsCollection.Insert(0, resetItem);

            if (this.OwningGrid.AllGridSettings.Count == 0)
            {
                this._deleteButton.IsEnabled = false;
            }

            if (this.OwningGrid.GridSettings != null && this.OwningGrid.GridSettings.Count > 0)
            {
                var reset = this.OwningGrid.GridSettings.FirstOrDefault(p => p.Name == RESET_NAME);
                if (reset != null)
                {
                    this.OwningGrid.GridSettings.Remove(reset);
                }

                this.OwningGrid.GridSettings.ForEach(p =>
                {
                    var item = new ComboBoxItem {
                        Content = p.Name
                    };
                    if (p.IsDefault)
                    {
                        item.Content = string.Format("{0}{1}", Default_Prefix, p.Name);
                    }
                    if (p.Name != RESET_NAME)
                    {
                        m_settingsCollection.Insert(1, item);
                    }
                });

                var defaultConfig = this.OwningGrid.GridSettings.FirstOrDefault(p => p.IsDefault);
                if (defaultConfig == null)
                {
                    currentConfig = this.OwningGrid.GridSettings[0];
                }
                else
                {
                    if (this.OwningGrid.ActualRowHeight < this._rowHeightInput.Maximum &&
                        this.OwningGrid.ActualRowHeight > this._rowHeightInput.Minimum)
                    {
                        this._rowHeightInput.Minimum = this.OwningGrid.ActualRowHeight;
                    }
                    if (this.OwningGrid.ActualRowHeight != 99999 &&
                        this.OwningGrid.ActualRowHeight > this._rowHeightInput.Maximum)
                    {
                        this._rowHeightInput.IsEnabled = false;
                    }
                    else
                    {
                        this._rowHeightInput.IsEnabled = true;
                    }
                    currentConfig = defaultConfig;
                }
                this.OwningGrid.PageSize = currentConfig.PageSize;
                //_rowHeightInput.Value = currentConfig.RowHeight;
                //_txtSettingName.Text = currentConfig.Name;
                foreach (var item in this._gridSettingsComboBox.Items)
                {
                    if ((item as ComboBoxItem).Content.ToString().Replace(Default_Prefix, "") == currentConfig.Name)
                    {
                        var index = m_settingsCollection.IndexOf((item as ComboBoxItem));
                        this._gridSettingsComboBox.SelectedIndex = index;
                        break;
                    }
                }

                if (flag)
                {
                    this.ApplyConfig(currentConfig);
                }
            }
            else
            {
                if (flag)
                {
                    this.ApplyConfig(m_resetGridConfig);
                }
                _txtSettingName.Text = string.Empty;
                this._gridSettingsComboBox.SelectedIndex = 0;
            }
        }
Beispiel #9
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            (GetTemplateChild("RowHeight") as TextBlock).Text      = Resource.RowHeight;
            (GetTemplateChild("RowBackground") as TextBlock).Text  = Resource.RowBackground;
            (GetTemplateChild("BandedRowColor") as TextBlock).Text = Resource.BandedRowColor;
            this._excelButton         = GetTemplateChild(Element_ExcelButton) as Button;
            this._excelButton.Click  += new RoutedEventHandler(_excelButton_Click);
            this._excelButton.Content = Resource.btn_Excel;

            (GetTemplateChild("ExportData") as TextBlock).Text = Resource.ExportTableData;

            this.m_tbResult            = GetTemplateChild(Element_tbResult) as TextBlock;
            this._txtSettingName       = GetTemplateChild(Element_GridSettingName) as TextBox;
            this._gridSettingsComboBox = GetTemplateChild(ElementGridSettingsComboBoxName) as ComboBox;
            this._gridSettingsComboBox.DisplayMemberPath = "Name";
            this._gridSettingsComboBox.ItemsSource       = this.m_settingsCollection;
            this._gridSettingsComboBox.SelectionChanged += new SelectionChangedEventHandler(_gridSettingsComboBox_SelectionChanged);


            (GetTemplateChild("txtPageSize") as TextBlock).Text = Resource.Pager_PerPage;

            if (_cmbPageSize != null)
            {
                _cmbPageSize.SelectionChanged -= new SelectionChangedEventHandler(_cmbPageSize_SelectionChanged);
            }
            this._cmbPageSize = GetTemplateChild(Element_PageSize) as ComboBox;
            this._cmbPageSize.SelectionChanged += new SelectionChangedEventHandler(_cmbPageSize_SelectionChanged);

            this._resetButton         = GetTemplateChild(Element_ButtonReset) as Button;
            this._resetButton.Content = Resource.ColumnsV3_Reset;
            this._resetButton.Click  += new RoutedEventHandler(_resetButton_Click);

            this._backgroundColorPicker                   = GetTemplateChild(ElementBackgroundColorPickerName) as ComboBox;
            this._backgroundColorPicker.ItemsSource       = new ColorsHelper().GetColorSet();
            this._backgroundColorPicker.SelectionChanged += new SelectionChangedEventHandler(_backgroundColorPicker_SelectionChanged);
            this._bandedColorPicker = GetTemplateChild(ElementBandedColorPickerName) as ComboBox;
            this._bandedColorPicker.SelectionChanged += new SelectionChangedEventHandler(_bandedColorPicker_SelectionChanged);
            this._bandedColorPicker.ItemsSource       = new ColorsHelper().GetColorSet();

            this._elementRoot          = GetTemplateChild(RootElementName) as FrameworkElement;
            this._expanderButton       = GetTemplateChild(ExpanderButtonName) as ToggleButton;
            this._elementPopup         = GetTemplateChild(ElementPopupName) as Popup;
            this._elementPopup.Opened += new EventHandler(_elementPopup_Opened);
            this._elementPopup.Closed += new EventHandler(_elementPopup_Closed);

            this._elementContentPresenterBorder = GetTemplateChild(ContentPresenterBorder) as FrameworkElement;

            this._customizeButton = GetTemplateChild(ElementCustomizeButtonName) as Button;
            if (this._customizeButton != null)
            {
                _customizeButton.Content     = Resource.ColumnsV2_Title;
                this._customizeButton.Click += new RoutedEventHandler(_customizeButton_Click);
            }
            this._rowHeightInput = GetTemplateChild(RowHeightInput) as NumericUpDown;
            //this._rowHeightInput.LostFocus += new RoutedEventHandler(_rowHeightInput_LostFocus);
            this._rowHeightInput.ValueChanged += new RoutedPropertyChangedEventHandler <double>(_rowHeightInput_ValueChanged);

            this._deleteButton         = GetTemplateChild(Element_DeleteButton) as Button;
            this._deleteButton.Content = Resource.ColumnsV2_btnDelete;
            this._deleteButton.Click  += new RoutedEventHandler(_deleteButton_Click);

            if (this._elementPopup != null)
            {
                this._elementPopupChild   = this._elementPopup.Child as FrameworkElement;
                this._elementOutsidePopup = new Canvas();
            }
            else
            {
                this._elementPopupChild   = null;
                this._elementOutsidePopup = null;
            }
            if (this._elementOutsidePopup != null)
            {
                this._elementOutsidePopup.Background           = new SolidColorBrush(Colors.Transparent);
                this._elementOutsidePopup.MouseLeftButtonDown += new MouseButtonEventHandler(ElementOutsidePopup_MouseLeftButtonDown);
            }
            if (this._elementPopupChild != null)
            {
                this._elementPopupChild.SizeChanged += new SizeChangedEventHandler(this.ElementPopupChild_SizeChanged);
                this._elementPopupChildCanvas        = new Canvas();
            }
            else
            {
                this._elementPopupChildCanvas = null;
            }
            if ((this._elementPopupChildCanvas != null) && (this._elementOutsidePopup != null))
            {
                this._elementPopup.Child = this._elementPopupChildCanvas;
                this._elementPopupChildCanvas.Children.Add(this._elementOutsidePopup);
                this._elementPopupChildCanvas.Children.Add(this._elementPopupChild);
            }

            //this._expanderButton.Click += new RoutedEventHandler(_expanderButton_Click);
            this._expanderButton.Checked   += new RoutedEventHandler(_expanderButton_Checked);
            this._expanderButton.Unchecked += new RoutedEventHandler(_expanderButton_Unchecked);


            base.SizeChanged += new SizeChangedEventHandler(this.ElementPopupChild_SizeChanged);
            this.IsOpen       = false;


            this.m_resetGridConfig = this.OwningGrid.m_resetGridConfig;

            RefreshGridConfig(true);
            InitPageSizeSet(ref this._cmbPageSize, this.OwningGrid);
            if (this.OwningGrid.m_customizeDialog != null)
            {
                //判断是否启用DataGridCustomizeColumn
                if (this.OwningGrid.m_customizeDialog.IsEnableCustomizeColumn())
                {
                    _customizeButton.Visibility = Visibility.Visible;
                    this.OwningGrid.m_customizeDialog.CheckDataGridColumnChanged();
                }
            }

            if (this.OwningGrid.DisableProfileRowHeight)
            {
                _rowHeightInput.IsEnabled = false;
                (GetTemplateChild("GridRowHeight") as Grid).Visibility          = Visibility.Collapsed;
                (GetTemplateChild("GridRowHeightLine") as Rectangle).Visibility = Visibility.Collapsed;
            }
        }
Beispiel #10
0
        internal void InitGridSettings()
        {
            if (this.OwningGrid.GridSettings != null && this.OwningGrid.GridSettings.Count > 0)
            {
                var config = this.OwningGrid.GridSettings.FirstOrDefault(p => p.Name == RESET_NAME);
                if (config != null)
                {
                    this.OwningGrid.GridSettings.Remove(config);
                }
                GridSetting currentSetting = null;
                this.m_comboSettings.Items.Clear();
                this.OwningGrid.GridSettings.ForEach(p =>
                {
                    ComboBoxItem item = new ComboBoxItem {
                        Content = p.Name
                    };

                    if (p.IsDefault)
                    {
                        item.IsSelected     = true;
                        currentSetting      = p;
                        item.Content        = Default_Prefix + p.Name;
                        this.m_txtName.Text = p.Name;
                    }
                    this.m_comboSettings.Items.Add(item);
                });
                //如果数据库中没有Default的配置,则取第一个(此种情况会在Delete default config后出现)
                if (currentSetting == null)
                {
                    this.m_comboSettings.SelectedIndex = 0;
                    this.m_txtName.Text = this.OwningGrid.GridSettings[0].Name;
                    currentSetting      = this.OwningGrid.GridSettings[0];
                }

                this.CurrentGridConfig      = currentSetting;
                this.m_chkDefault.IsChecked = currentSetting.IsDefault;
                var re = this.m_cmbPageSize.Items.FirstOrDefault(p =>
                {
                    return((p as ComboBoxItem).Content.ToString() == currentSetting.PageSize.ToString());
                });
                var index = this.m_cmbPageSize.Items.IndexOf(re);
                this.m_cmbPageSize.SelectedIndex = index;

                this.m_availableColumns.Clear();
                this.m_selectedColumns.Clear();

                //Edit by Hax 20100203
                this.OwningGrid.m_resetGridConfig.Columns.ForEach(p =>
                {
                    var colConfig = this.CurrentGridConfig.Columns.FirstOrDefault(q => q.Name == p.Name);
                    if (colConfig != null)
                    {
                        if (!colConfig.IsHided)
                        {
                            var item      = GenerateListBoxItemExt(ExtType.Remove, colConfig);
                            item.ColIndex = colConfig.Index;
                            this.m_selectedColumns.Add(item);
                        }
                        else
                        {
                            var item = GenerateListBoxItemExt(ExtType.Add, colConfig);
                            this.m_availableColumns.Add(item);
                        }
                    }
                    else
                    {
                        var item      = new ListBoxItemExt(ExtType.Add);
                        item.AddItem += new EventHandler(item_AddItem);
                        item.Name     = string.Format(this.m_listBoxItemName_Prefix, p.Name);

                        var column = GetColumnByName(p.Name);
                        if (column != null && column.Header != null)
                        {
                            item.ColWidth = column.ActualWidth;
                            item.Content  = column.Header;
                            this.m_availableColumns.Add(item);
                        }
                    }
                });

                var list = m_selectedColumns.ToList();
                list.Sort((x, y) =>
                {
                    if (x.ColIndex > y.ColIndex)
                    {
                        return(1);
                    }
                    else if (x.ColIndex == y.ColIndex)
                    {
                        return(0);
                    }
                    else
                    {
                        return(-1);
                    }
                });

                m_selectedColumns.Clear();

                list.ForEach(p => m_selectedColumns.Add(p));

                /*
                 * Comment by Hax--20100203
                 * 为了避免以后开发人员增加或删除xaml中DataGrid的Column,造成新增加的Column在AvailableColumn中显示不出来
                 * 修改为根据DataGrid的ResetColumns(开发时设置的Column)来产生AvailableColumn和SelectedItem,而不是根据CurrentGridConfig来生成
                 */

                //this.CurrentGridConfig.Columns.ForEach(p =>
                //{
                //    var column = GetColumnByName(p.Name);

                //    if (column != null)
                //    {
                //        if (!p.IsHided)
                //        {
                //            var item = GenerateListBoxItemExt(ExtType.Remove, p);
                //            this.m_selectedColumns.Add(item);
                //        }
                //        else
                //        {
                //            var item = GenerateListBoxItemExt(ExtType.Add, p);
                //            this.m_availableColumns.Add(item);
                //        }
                //    }
                //});
            }
            else
            {
                GenerateLeftListBoxItem();
                //GenerateDefaultConfig();
            }

            this.m_availableColumnsListBox.ItemsSource = this.m_availableColumns;
            this.m_selectedColumnsListBox.ItemsSource  = this.m_selectedColumns;
        }