/*
         * 构造函数:
         * 参数一:用于传入需要更改的列
         */
        public AlterColumnWindow(Column column)
        {
            // 初始化图形元素
            this.Width = 300;
            this.Height = 200;
            _column = column;
            _list = _column.Header.Data;
            _grid = new Grid();
            _grid.ColumnDefinitions.Add(new ColumnDefinition());
            _grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(130) });
            _grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(50) });
            _tab = new TabControl();
            Grid.SetColumn(_tab, 0);
            Grid.SetRow(_tab, 0);

            initializeTabControl();
            initializeButton();

            _grid.Children.Add(_panel);
            _grid.Children.Add(_tab);
            this.Content = _grid;
        }
        private void initializeData(double width, DataModel model, String path)
        {
            // 获取图形显示配置
            _configPath = path;
            XmlDocument doc = new XmlDocument();
            doc.Load(_configPath);
            XmlNode node = doc.SelectSingleNode("Diagram/ColumnBody/CanvasHeight");
            _bodyHeight = Int32.Parse(node.InnerText);
            node = doc.SelectSingleNode("Diagram/ColumnHeader/Height");
            _headerHeight = Int32.Parse(node.InnerText);
            _width = width;

            _colWidth = adjustColumnWidth(width, model.DataList.Count);
            _model = model;
            _columns = new List<Column>();
            _headerPanel = new StackPanel();
            _headerPanel.Orientation = Orientation.Horizontal;
            _bodyViewer = new ScrollViewer();
            _bodyViewer.Height = Int32.Parse(doc.SelectSingleNode("Diagram/BodyViewer/Height").InnerText);
            _bodyPanel = new StackPanel();
            _bodyPanel.Orientation = Orientation.Horizontal;
            _bodyViewer.Content = _bodyPanel;

            List<List<Data>> list = new List<List<Data>>();
            for (int i = 0; i < _model.ColumnNumber; ++i)
            {
                List<Data> datalist = new List<Data>();
                list.Add(datalist);
            }
            for (int i = 0; i < _model.DataList.Count; ++i)
            {
                Data d = _model.DataList.ElementAt(i);
                if (d.DefaultColumnPos.Count == 0)
                    continue;
                for (int j = 0; j < d.DefaultColumnPos.Count; ++j)
                    list.ElementAt(d.DefaultColumnPos.ElementAt(j) - 1).Add(d);
            }

            _scale = new ScaleColumn(_colWidth, _headerHeight, _bodyHeight);
            _headerPanel.Children.Add(_scale.Header);
            _bodyPanel.Children.Add(_scale.Body);
            for (int i = 0; i < _model.ColumnNumber; ++i)
            {
                Column c = new Column(_colWidth, _headerHeight, _bodyHeight, list.ElementAt(i), _model);
                _columns.Add(c);
                _headerPanel.Children.Add(c.Header);
                _bodyPanel.Children.Add(c.Body);
            }
        }
 public void addColumn(int pos, List<Data> list)
 {
     Column c = new Column(_colWidth, _headerHeight, _bodyHeight, list, _model);
     _columns.Insert(pos, c);
     _headerPanel.Children.Insert(pos + 1, c.Header);
     _bodyPanel.Children.Insert(pos + 1, c.Body);
     adjustGraphics();
 }