Exemple #1
0
        public void LinkCell()
        {
            int i    = GridRow.Index;
            var grid = GridRow.Grid as MyGrid;

            if (string.IsNullOrEmpty(GridPropertyName))
            {
                return;
            }

            //grid.LinkedCells[GridPropertyName] = new CellContext(grid, new Position(i, cellnr), grid[i, cellnr]);
            grid.LinkedRows.Add(GridPropertyName, this);

            var bp = new DataCellController(this);

            DataCell.AddController(bp);

            if (string.IsNullOrEmpty(EditorTemplateName) && !ReadOnly && DataCell.Editor.EditableMode != EditableMode.None)
            {
                DataCell.Editor.EditableMode = EditableMode.AnyKey | EditableMode.DoubleClick |
                                               EditableMode.F2Key | EditableMode.SingleClick;
            }

            if (DataSource != null && DataMember != null)
            {
                var bd = new Binding(GridPropertyName, DataSource, DataMember, true, DataSourceUpdateMode.OnPropertyChanged);

                (grid.MyData as IBindableComponent).DataBindings.Add(bd);
            }
        }