protected virtual float GetCellDesiredWidth(DetailListViewCellElement cell) { cell.IgnoreColumnWidth = true; cell.Measure(new SizeF(float.PositiveInfinity, float.PositiveInfinity)); cell.IgnoreColumnWidth = false; return(cell.DesiredSize.Width); }
protected override bool IsDropTargetValid(ISupportDrop dropTarget) { DetailListViewCellElement listViewCellElement = dropTarget as DetailListViewCellElement; if (listViewCellElement != null) { return(listViewCellElement.Data != this.draggedColumn); } return(base.IsDropTargetValid(dropTarget)); }
protected virtual float CalculateColumnWidth( ListViewDetailColumn column, ListViewBestFitColumnMode mode) { IVirtualizedElementProvider <ListViewDataItem> elementProvider = this.DetailListView.Scroller.ElementProvider; float val1 = 0.0f; if (mode == ListViewBestFitColumnMode.HeaderCells || mode == ListViewBestFitColumnMode.AllCells) { DetailListViewHeaderCellElement element = this.DetailListView.ColumnScroller.ElementProvider.GetElement(column, (object)null) as DetailListViewHeaderCellElement; this.DetailListView.ColumnContainer.Children.Add((RadElement)element); element.Attach(column, (object)null); element.ResetLayout(true); val1 = Math.Max(val1, this.GetCellDesiredWidth((DetailListViewCellElement)element)); this.DetailListView.ColumnContainer.Children.Remove((RadElement)element); this.Detach(this.DetailListView.ColumnScroller.ElementProvider, (DetailListViewCellElement)element); if (mode == ListViewBestFitColumnMode.HeaderCells) { return(val1); } } IEnumerator <ListViewDataItem> enumerator = (IEnumerator <ListViewDataItem>)null; if (mode == ListViewBestFitColumnMode.DataCells || mode == ListViewBestFitColumnMode.AllCells) { enumerator = (IEnumerator <ListViewDataItem>) new ListViewTraverser(this.DetailListView.Owner); } enumerator.Reset(); while (enumerator.MoveNext()) { ListViewDataItem current = enumerator.Current; if (this.CanBestFitItem(current)) { DetailListViewVisualItem element1 = elementProvider.GetElement(current, (object)null) as DetailListViewVisualItem; element1.Attach(current, (object)null); this.DetailListView.ColumnContainer.Children.Add((RadElement)element1); IVirtualizedElementProvider <ListViewDetailColumn> cellElementProvider = (IVirtualizedElementProvider <ListViewDetailColumn>) new DetailListViewDataCellElementProvider(element1); DetailListViewCellElement element2 = cellElementProvider.GetElement(column, (object)element1) as DetailListViewCellElement; element1.Children.Add((RadElement)element2); element2.Attach(column, (object)element1); element2.ResetLayout(true); val1 = Math.Max(val1, this.GetCellDesiredWidth(element2)); element1.Children.Remove((RadElement)element2); this.DetailListView.ColumnContainer.Children.Remove((RadElement)element1); this.Detach(cellElementProvider, element2); this.Detach(elementProvider, element1); } } return(val1); }
protected override void PerformStart() { base.PerformStart(); DetailListViewCellElement context = this.Context as DetailListViewCellElement; if (context == null) { this.Stop(false); } else { this.draggedColumn = context.Data; this.PrepareDragHint(); } }
protected override void PerformStart() { base.PerformStart(); DetailListViewCellElement draggedColumn = this.Context as DetailListViewCellElement; if (draggedColumn == null) { this.Stop(false); return; } this.draggedColumn = draggedColumn.Data; this.PrepareDragHint(); }
protected override bool MeasureElement(IVirtualizedElement <ListViewDetailColumn> element) { DetailListViewCellElement listViewCellElement = element as DetailListViewCellElement; if (listViewCellElement == null) { return(false); } SizeF sizeF = this.MeasureElementCore((RadElement)listViewCellElement, this.availableSize); this.desiredSize.Height = Math.Max(this.desiredSize.Height, sizeF.Height); this.desiredSize.Width += sizeF.Width; if (this.ScrollColumns) { return((double)this.desiredSize.Width - (double)this.context.ColumnScrollBar.Value < (double)this.availableSize.Width); } return(true); }
private void Detach( IVirtualizedElementProvider <ListViewDetailColumn> cellElementProvider, DetailListViewCellElement cell) { if (cell != null) { cellElementProvider.CacheElement((IVirtualizedElement <ListViewDetailColumn>)cell); cell.Detach(); if (cell.Parent == null || !cell.Parent.Children.Contains((RadElement)cell)) { return; } cell.Parent.Children.Remove((RadElement)cell); } else { cell.Dispose(); } }
protected override bool MeasureElement(IVirtualizedElement <ListViewDetailColumn> element) { DetailListViewCellElement cell = element as DetailListViewCellElement; if (cell == null) { return(false); } SizeF desiredCellSize = MeasureElementCore(cell, availableSize); desiredSize.Height = Math.Max(desiredSize.Height, desiredCellSize.Height); desiredSize.Width += desiredCellSize.Width; if (ScrollColumns) { return(desiredSize.Width - this.context.ColumnScrollBar.Value < availableSize.Width); } return(true); }
protected override void OnPreviewDragOver(RadDragOverEventArgs e) { DetailListViewCellElement hitTarget = e.HitTarget as DetailListViewCellElement; DetailListViewCellElement dragInstance = e.DragInstance as DetailListViewCellElement; if (hitTarget != null && dragInstance != null) { ListViewDetailColumn data1 = hitTarget.Data; ListViewDetailColumn data2 = dragInstance.Data; if (data1 == null || data2 == null || data1.Owner != data2.Owner) { e.CanDrop = false; } } base.OnPreviewDragOver(e); if (e.CanDrop) { return; } this.DisposeDragHint(); }
protected override void OnPreviewDragDrop(RadDropEventArgs e) { DetailListViewCellElement hitTarget = e.HitTarget as DetailListViewCellElement; if (hitTarget == null) { base.OnPreviewDragDrop(e); } else { ListViewDetailColumn data = hitTarget.Data; int num = this.owner.Owner.Columns.IndexOf(this.draggedColumn); int index = e.DropLocation.X <= hitTarget.Size.Width / 2 ^ this.owner.RightToLeft ? this.owner.Owner.Columns.IndexOf(data) : this.owner.Owner.Columns.IndexOf(data) + 1; this.owner.Owner.Columns.Remove(this.draggedColumn); if (num < index) { --index; } this.owner.Owner.Columns.Insert(index, this.draggedColumn); this.owner.InvalidateMeasure(true); base.OnPreviewDragDrop(e); } }
protected override void OnPreviewDragDrop(RadDropEventArgs e) { DetailListViewCellElement targetElement = e.HitTarget as DetailListViewCellElement; ListViewDetailColumn targetColumn = targetElement.Data; int draggedIndex = owner.Owner.Columns.IndexOf(draggedColumn); int targetIndex = e.DropLocation.X <= targetElement.Size.Width / 2 ? owner.Owner.Columns.IndexOf(targetColumn): owner.Owner.Columns.IndexOf(targetColumn) + 1; owner.Owner.Columns.Remove(draggedColumn); if (draggedIndex < targetIndex) { targetIndex--; } owner.Owner.Columns.Insert(targetIndex, draggedColumn); owner.InvalidateMeasure(true); base.OnPreviewDragDrop(e); }
public ListViewCellFormattingEventArgs(DetailListViewCellElement cellElement) { this.cellElement = cellElement; }
internal override bool ProcessMouseUp(MouseEventArgs e) { if (this.owner.EnableKineticScrolling && this.ViewElement.ContainsMouse) { this.scrollBehavior.MouseUp(e.Location); } else { this.scrollBehavior.Stop(); } this.owner.ColumnResizingBehavior.EndResize(); if (e.Button == MouseButtons.Left) { ListViewDataItem itemUnderMouse = this.GetItemAt(e.Location); DetailListViewCellElement cellUnderMouse = this.ElementTree.GetElementAtPoint(e.Location) as DetailListViewCellElement; if (itemUnderMouse == null || !itemUnderMouse.Enabled) { this.lastModifierKeys = Keys.None; this.groupSelectionTimer.Stop(); this.beginEditTimer.Stop(); this.lastClickedItem = null; return(false); } if (itemUnderMouse is ListViewDataItemGroup) { if (itemUnderMouse != null && !this.disableGroupSelectOnMouseUp) { this.lastClickedItem = itemUnderMouse; this.lastModifierKeys = Control.ModifierKeys; this.groupSelectionTimer.Start(); } else { this.lastClickedItem = null; this.lastModifierKeys = Keys.None; this.groupSelectionTimer.Stop(); } return(false); } this.lastClickedItem = null; this.lastModifierKeys = Keys.None; this.groupSelectionTimer.Stop(); if (itemUnderMouse != null && !disableEditOnMouseUp && itemUnderMouse == this.owner.SelectedItem && Control.ModifierKeys == Keys.None && this.lastClickedItem == null && cellUnderMouse != null && cellUnderMouse.Data == this.owner.CurrentColumn) { this.lastClickedItem = itemUnderMouse; this.beginEditTimer.Start(); } else { this.beginEditTimer.Stop(); this.lastClickedItem = null; if (Control.ModifierKeys != Keys.None || itemUnderMouse != this.owner.SelectedItem) { this.ProcessSelection(itemUnderMouse, Control.ModifierKeys, true); } if (cellUnderMouse != null) { cellUnderMouse.Data.Current = true; } } } else { this.lastModifierKeys = Keys.None; this.groupSelectionTimer.Stop(); this.beginEditTimer.Stop(); this.lastClickedItem = null; } return(false); }
protected internal override bool ProcessMouseUp(MouseEventArgs e) { if (this.Owner.EnableKineticScrolling && this.ViewElement.ContainsMouse) { this.ScrollBehavior.MouseUp(e.Location); } else { if (this.Capture) { base.ProcessMouseUp(e); return(false); } this.ScrollBehavior.Stop(); } bool isResizing = this.Owner.ColumnResizingBehavior.IsResizing; this.Owner.ColumnResizingBehavior.EndResize(); if (e.Button == MouseButtons.Left) { ListViewDataItem itemAt = this.GetItemAt(e.Location); DetailListViewCellElement elementAtPoint = this.ElementTree.GetElementAtPoint(e.Location) as DetailListViewCellElement; DetailListViewHeaderCellElement headerCellUnderMouse = elementAtPoint as DetailListViewHeaderCellElement; if (headerCellUnderMouse != null && !isResizing) { this.SortByHeaderCell(headerCellUnderMouse, e.Location); } if (itemAt == null || !itemAt.Enabled) { this.lastModifierKeys = Keys.None; this.groupSelectionTimer.Stop(); this.beginEditTimer.Stop(); this.lastClickedItem = (ListViewDataItem)null; return(false); } if (itemAt is ListViewDataItemGroup) { if (itemAt != null && !this.disableGroupSelectOnMouseUp) { this.lastClickedItem = itemAt; this.lastModifierKeys = Control.ModifierKeys; this.groupSelectionTimer.Start(); } else { this.lastClickedItem = (ListViewDataItem)null; this.lastModifierKeys = Keys.None; this.groupSelectionTimer.Stop(); } return(false); } this.lastClickedItem = (ListViewDataItem)null; this.lastModifierKeys = Keys.None; this.groupSelectionTimer.Stop(); bool flag = this.ElementTree.GetElementAtPoint(e.Location) is ListViewItemCheckbox; if (itemAt.Selected && this.Owner.ShowCheckBoxes && (!this.Owner.AllowEdit && this.Owner.CheckOnClickMode != CheckOnClickMode.Off) && !flag) { this.ToggleItemCheckState(itemAt); } else if (!itemAt.Selected && this.Owner.ShowCheckBoxes && (this.Owner.CheckOnClickMode == CheckOnClickMode.FirstClick && !flag)) { this.ToggleItemCheckState(itemAt); } if (itemAt != null && !this.disableEditOnMouseUp && (itemAt == this.Owner.SelectedItem && Control.ModifierKeys == Keys.None) && (this.lastClickedItem == null && elementAtPoint != null && elementAtPoint.Data == this.Owner.CurrentColumn)) { this.lastClickedItem = itemAt; this.beginEditTimer.Start(); } else { this.beginEditTimer.Stop(); this.lastClickedItem = (ListViewDataItem)null; if (Control.ModifierKeys != Keys.None || itemAt != this.Owner.SelectedItem) { this.ProcessSelection(itemAt, Control.ModifierKeys, true); } if (elementAtPoint != null && elementAtPoint.Data != null) { elementAtPoint.Data.Current = true; } } } else { this.lastModifierKeys = Keys.None; this.groupSelectionTimer.Stop(); this.beginEditTimer.Stop(); this.lastClickedItem = (ListViewDataItem)null; } return(false); }