Example #1
0
        public void LinkGrid()
        {
            if (!makeGridCompleted)
            {
                throw new Exception("MakeGrid not completed");
            }

            LinkedCells.Clear();
            LinkedRows.Clear();

            if (MyDataBC == null)
            {
                throw new Exception("Bad MyData");
            }

            for (int i = 0; i < gridRowList.Count; i++)
            {
                var rowdef = gridRowList[i];
                try
                {
                    rowdef.LinkRow();
                    rowdef.UpdateDataCell();
                }
                catch (Exception ex)
                {
                    throw new Exception("LinkRow failed: " + rowdef.Name, ex);
                }
            }
        }
Example #2
0
        public void UnLinkGrid()
        {
            if (MyDataBC == null)
            {
                return;
            }
            var mi = myData as INotifyPropertyChanged;

            if (mi != null)
            {
                mi.PropertyChanged -= OnMyGridPropertyChanged;
            }
            var mbc = MyData as IBindableComponent;

            if (mbc != null)
            {
                mbc.DataBindings.Clear();
            }
            for (int i = 0; i < gridRowList.Count; i++)
            {
                var rowdef = gridRowList[i];
                try
                {
                    rowdef.UnLinkRow();
                }
                catch (Exception ex)
                {
                    throw new Exception("UnLinkRow failed: " + rowdef.Name, ex);
                }
            }
            linkedRows.Clear();
            LinkedCells.Clear();
        }
Example #3
0
        public void MakeGrid()
        {
            LinkedCells.Clear();
            LinkedRows.Clear();

            this.ColumnsCount     = 3;
            this.Columns[0].Width = ColumnWidth1;
            this.Columns[1].Width = ColumnWidth2;
            this.Columns[2].Width = ColumnWidth3;

            for (int i = 0; i < gridRowTemplateList.Count; i++)
            {
                var rowdef = gridRowTemplateList[i];
                rowdef.MakeTemplateRow(this);
            }

            int rowscount = 0;

            for (int i = 0; i < gridRowList.Count; i++)
            {
                rowscount += gridRowList[i].GetRowCount();
            }

            this.RowsCount = rowscount;

            int rownr = 0;

            for (int i = 0; i < gridRowList.Count; i++)
            {
                var rowdef = gridRowList[i];
                rowdef.MakeRow(Rows[rownr]);
                rownr += rowdef.GetRowCount();
            }
            ScaleControlA(scaleFactor);

            this.Controller.AddController(MarkCurrentRowController.Default);

            makeGridCompleted = true;
        }