Пример #1
0
        protected override void OnElementAttached()
        {
            base.OnElementAttached();

            // If this is a "rectangular" table then automatically add the "unselectable"
            // attribute to it because we know we can support editing of it without
            // erratic behavior
            TableHelper.MakeTableWriterEditableIfRectangular(HTMLElement as IHTMLTable);

            // Is the table editable?
            _tableIsEditable = TableHelper.TableElementIsEditable(HTMLElement, ElementRange);

            if (_tableIsEditable)
            {
                // hookup column size editor and cell selection tracker
                _columnSizeEditor     = new TableColumnSizeEditor(HTMLElement as IHTMLTable, EditorContext, HTMLPaintSite);
                _cellSelectionTracker = new TableCellSelectionTracker(this, TableEditingContext);

                HookEvents();

                // make it unselecteable
                HTMLElement.setAttribute("unselectable", "on", 0);

                // if the table has no borders then set a runtime style that lets the user see the borders
                TableHelper.UpdateDesignTimeBorders(HTMLElement as IHTMLTable, HTMLElement as IHTMLElement2);

                _tableEditingInitialized = true;
            }
        }
        protected override void OnElementAttached()
        {
            // call base
            base.OnElementAttached();

            // determine whether the cell is editable
            _cellIsEditable = TableHelper.TableElementIsEditable(HTMLElement, ElementRange);

            // if editable then do our thing
            if (_cellIsEditable)
            {
                // add ourselves to the list of cell element behaviors
                TableEditingContext.AddCellBehavior(this);

                // if the table has no borders then set a runtime style that lets the user see the borders
                TableHelper.UpdateDesignTimeBorders(
                    TableHelper.GetContainingTableElement(HTMLElement),
                    HTMLElement as IHTMLElement2);
            }
        }