Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CellValuePresenter"/> class.
        /// </summary>
        /// <param name="parentCell">The parent cell.</param>
        public CellValuePresenter(DetailCell parentCell)
        {
            _parentCell = parentCell;
            BindingOperations.SetBinding(this, ContainedValueProperty, new Binding("ContainedValue") { Mode = BindingMode.TwoWay });
            BindingOperations.SetBinding(this, ContentWrappingProperty, new Binding("Column.Wrapping"));
            BindingOperations.SetBinding(this, HorizontalAlignmentProperty, new Binding("Column.HorizontalAlignment"));
            BindingOperations.SetBinding(this, VerticalAlignmentProperty, new Binding("Column.VerticalAlignment"));            

            _editorDataContext = _parentCell.CellEditorDataContext is DetailCell ? this : _parentCell.CellEditorDataContext;
            _editTemplate = _parentCell.CellEditTemplate;
            _viewTemplate = _parentCell.CellViewTemplate;
            SetEditorParams(_editorDataContext, _editTemplate, _viewTemplate);

            _parentCell.PropertyChanged += OnParentCellPropertyChanged;
        }
Esempio n. 2
0
        /// <summary>
        /// Disposes this instance.
        /// </summary>
        internal override void Dispose()
        {
            base.Dispose();

            _editTemplate = null;
            _viewTemplate = null;
            _editorDataContext = null;

            if (_parentCell != null)
            {
                _parentCell.PropertyChanged -= OnParentCellPropertyChanged;
                _parentCell = null;
            }
        }