private static void IsEnabledChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { AyTableView atv = d as AyTableView; var listBox = atv.RowsPresenter; if (listBox != null) { if ((bool)e.NewValue) { if (atv.SelectionMode == AyTableViewSelectionMode.Single) { atv.SelectionMode = AyTableViewSelectionMode.Multiple; } attachedControls.Add(listBox, new AyTableViewSelector(listBox, atv)); } else { AyTableViewSelector selector; if (attachedControls.TryGetValue(listBox, out selector)) { attachedControls.Remove(listBox); selector.UnRegister(); } } } }
protected override void OnIsItemsHostChanged(bool oldIsItemsHost, bool newIsItemsHost) { base.OnIsItemsHostChanged(oldIsItemsHost, newIsItemsHost); var rowPresenter = AyTableViewUtils.FindParent <AyTableViewCellsPresenter>(this); if (rowPresenter != null) { rowPresenter.CellsPanel = this; ParentTableView = rowPresenter.ParentTableView; this.Style = ParentTableView.CellsPanelStyle; } }
private AyTableViewSelector(AyTableViewRowsPresenter listBox, AyTableView tv) { this.listBox = listBox; this.twv = tv; if (this.listBox.IsLoaded) { this.Register(); } else { // We need to wait for it to be loaded so we can find the // child controls. this.listBox.Loaded += this.OnListBoxLoaded; } }
public void PrepareRow(AyTableView parent, object dataItem) { ParentTableView = parent; Focusable = ParentTableView.CellNavigation == false; Item = dataItem; var scp = ParentTableView.SelectedCellsPresenter; var _cRow = ParentTableView.IndexOfRow(this); IsAlterRowLine = (_cRow + 1) % 2 == 0; if (scp != null) { if (ParentTableView.SelectionMode == AyTableViewSelectionMode.Single) { isMouseLeftDown = 2; IsSelected = ParentTableView.IndexOfRow(scp) == _cRow; isMouseLeftDown = 1; } } }
public void PrepareCell(AyTableViewCellsPresenter parent, int idx) { ParentCellsPresenter = parent; ParentTableView = parent.ParentTableView; var column = ParentTableView.Columns[idx]; //IsSelected = ParentCellsPresenter.IsSelected() && (ParentTableView.FocusedColumnIndex == column.ColumnIndex); if (_column != column) { _column = column; this.Width = column.Width; BindingOperations.ClearBinding(this, WidthProperty); BindingOperations.SetBinding(this, WidthProperty, column.WidthBinding); Focusable = ParentTableView.CellNavigation; BindingOperations.ClearBinding(this, ColumnFocusBrushProperty); BindingOperations.SetBinding(this, ColumnFocusBrushProperty, new Binding { Source = _column, Mode = BindingMode.TwoWay, Path = new PropertyPath("ColumnFocusBrush") }); } column.GenerateCellContent(this); }