コード例 #1
0
        public override NSTableCellView GetCell(Cell item, NSTableCellView reusableCell, NSTableView tv)
        {
            EntryCell entryCell = (EntryCell)item;

            EntryCellRenderer.EntryCellTableViewCell cell = reusableCell as EntryCellRenderer.EntryCellTableViewCell;
            if (cell == null)
            {
                cell = new EntryCellRenderer.EntryCellTableViewCell((item).GetType().FullName);
            }
            else
            {
                cell.Cell.PropertyChanged      -= OnCellPropertyChanged;
                cell.TextFieldTextChanged      -= new EventHandler(EntryCellRenderer.OnTextFieldTextChanged);
                cell.KeyboardDoneButtonPressed -= new EventHandler(EntryCellRenderer.OnKeyBoardDoneButtonPressed);
            }
            CellRenderer.SetRealCell((BindableObject)item, (NSTableCellView)cell);
            cell.Cell = item;
            cell.Cell.PropertyChanged      += OnCellPropertyChanged;
            cell.TextFieldTextChanged      += new EventHandler(EntryCellRenderer.OnTextFieldTextChanged);
            cell.KeyboardDoneButtonPressed += new EventHandler(EntryCellRenderer.OnKeyBoardDoneButtonPressed);
            this.UpdateBackground((NSTableCellView)cell, (Cell)entryCell);
            EntryCellRenderer.UpdateLabel(cell, entryCell);
            EntryCellRenderer.UpdateText(cell, entryCell);
            //EntryCellRenderer.UpdateKeyboard (cell, entryCell);
            EntryCellRenderer.UpdatePlaceholder(cell, entryCell);
            EntryCellRenderer.UpdateLabelColor(cell, entryCell);
            EntryCellRenderer.UpdateHorizontalTextAlignment(cell, entryCell);
            EntryCellRenderer.UpdateIsEnabled(cell, entryCell);
            return((NSTableCellView)cell);
        }
コード例 #2
0
        private static void OnCellPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            EntryCell entryCell = (EntryCell)sender;

            EntryCellRenderer.EntryCellTableViewCell cell = (EntryCellRenderer.EntryCellTableViewCell)CellRenderer.GetRealCell((BindableObject)entryCell);
            if (e.PropertyName == EntryCell.LabelProperty.PropertyName)
            {
                EntryCellRenderer.UpdateLabel(cell, entryCell);
            }
            else if (e.PropertyName == EntryCell.TextProperty.PropertyName)
            {
                EntryCellRenderer.UpdateText(cell, entryCell);
            }
            else if (e.PropertyName == EntryCell.PlaceholderProperty.PropertyName)
            {
                EntryCellRenderer.UpdatePlaceholder(cell, entryCell);
            }
            //else if (e.PropertyName == EntryCell.KeyboardProperty.PropertyName)
            //	EntryCellRenderer.UpdateKeyboard (cell, entryCell);
            else if (e.PropertyName == EntryCell.LabelColorProperty.PropertyName)
            {
                EntryCellRenderer.UpdateLabelColor(cell, entryCell);
            }
            else if (e.PropertyName == EntryCell.HorizontalTextAlignmentProperty.PropertyName)
            {
                EntryCellRenderer.UpdateHorizontalTextAlignment(cell, entryCell);
            }
            else
            {
                if (!(e.PropertyName == Cell.IsEnabledProperty.PropertyName))
                {
                    return;
                }
                EntryCellRenderer.UpdateIsEnabled(cell, entryCell);
            }
        }