protected override void EnsureItemVisibleHorizontal(ListViewDataItem item) { RadElement element = (RadElement)this.GetElement(item); if (element == null) { return; } this.HScrollBar.Value = element.Bounds.Left; }
protected override void HandleUpKey(KeyEventArgs e) { ListViewDataItem listViewDataItem = this.Orientation == Orientation.Vertical ? this.GetUpperItem(this.Owner.CurrentItem) : this.GetPreviousItem(this.Owner.CurrentItem); if (listViewDataItem == null) { return; } this.ProcessSelection(listViewDataItem, Control.ModifierKeys, false); }
public virtual object this[ListViewDataItem item] { get { return(item.Cache[this.column]); } set { this.SetUnboundValue(item, value); } }
public override void Attach(ListViewDataItem data, object context) { if (data.Owner.ShowCheckBoxes) { this.ToggleElement.Visibility = ElementVisibility.Visible; } else { this.ToggleElement.Visibility = ElementVisibility.Collapsed; } base.Attach(data, context); }
public override void Attach(ListViewDataItem data, object context) { base.Attach(data, context); cellContainer.Context = dataItem.Owner.ViewElement as DetailListViewElement; cellContainer.DataProvider = cellContainer.Context.ColumnScroller; cellContainer.Context.ColumnScroller.ScrollerUpdated += new EventHandler(ColumnScroller_ScrollerUpdated); foreach (DetailListViewDataCellElement cell in this.cellContainer.Children) { cell.Synchronize(); } }
private void SetUnboundValue(ListViewDataItem item, object value) { if (item != null && this.Owner != null && !this.suspendItemChanged) { this.Owner.ListSource.NotifyItemChanging(item); } item.Cache[this.column] = value; if (item == null || this.Owner == null || this.suspendItemChanged) { return; } this.Owner.ListSource.NotifyItemChanged(item); }
protected override void EnsureItemVisibleVerticalCore(ListViewDataItem item) { if (this.Orientation == Orientation.Horizontal) { this.EnsureItemVisibleHorizontal(item); } else { int val1 = 0; BaseListViewVisualItem element1 = this.GetElement(item); if (element1 == null) { this.Scroller.ScrollToItem(item); this.Scroller.Scrollbar.PerformLargeDecrement(1); this.ViewElement.UpdateLayout(); element1 = this.GetElement(item); } if (element1 != null) { if (element1.ControlBoundingRectangle.Bottom <= this.ViewElement.ControlBoundingRectangle.Bottom) { return; } this.EnsureItemVisible(item); } else { ListViewTraverser enumerator = (ListViewTraverser)this.Scroller.Traverser.GetEnumerator(); while (enumerator.MoveNext()) { val1 = Math.Max(val1, (int)this.ViewElement.ElementProvider.GetElementSize(enumerator.Current).Height + this.ItemSpacing); if (enumerator.Current.IsLastInRow) { this.SetScrollValue(this.VScrollBar, this.VScrollBar.Value + val1); val1 = 0; this.UpdateLayout(); BaseListViewVisualItem element2 = this.GetElement(item); if (element2 != null) { if (element2.ControlBoundingRectangle.Bottom <= this.ViewElement.ControlBoundingRectangle.Bottom) { break; } this.EnsureItemVisible(item); break; } } } } } }
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); }
public override void Attach(ListViewDataItem data, object context) { if (data.Owner.ShowCheckBoxes) { this.ToggleElement.Visibility = ElementVisibility.Visible; } else { this.ToggleElement.Visibility = ElementVisibility.Collapsed; } base.Attach(data, context); this.cellContainer.Context = this.dataItem.Owner.ViewElement as DetailListViewElement; this.cellContainer.DataProvider = (IEnumerable)this.cellContainer.Context.ColumnScroller; this.cellContainer.Context.ColumnScroller.ScrollerUpdated += new EventHandler(this.ColumnScroller_ScrollerUpdated); }
public override object ConvertTo( ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if ((object)destinationType == null) { throw new ArgumentNullException(nameof(destinationType)); } if ((object)destinationType == (object)typeof(InstanceDescriptor) && value is ListViewDataItem) { ListViewDataItem listViewDataItem = (ListViewDataItem)value; string[] strArray = new string[listViewDataItem.SubItems.Count]; for (int index = 0; index < strArray.Length; ++index) { strArray[index] = Convert.ToString(listViewDataItem.SubItems[index]); } if (listViewDataItem.SubItems.Count == 0) { ConstructorInfo constructor = typeof(ListViewDataItem).GetConstructor(new Type[1] { typeof(string) }); if ((object)constructor != null) { return((object)new InstanceDescriptor((MemberInfo)constructor, (ICollection) new object[1] { (object)listViewDataItem.Text }, false)); } } ConstructorInfo constructor1 = typeof(ListViewDataItem).GetConstructor(new Type[2] { typeof(string), typeof(string[]) }); if ((object)constructor1 != null) { return((object)new InstanceDescriptor((MemberInfo)constructor1, (ICollection) new object[2] { (object)listViewDataItem.Text, (object)strArray }, false)); } } if ((object)destinationType == (object)typeof(string) && value is ListViewDataItem) { return((object)((ListViewDataItem)value).Text); } return(base.ConvertTo(context, culture, value, destinationType)); }
protected override void HandleLeftKey(KeyEventArgs e) { ListViewDataItemGroup group = this.owner.CurrentItem as ListViewDataItemGroup; if (group != null) { group.Expanded = false; } else { ListViewDataItem previousItem = GetPreviousItem(this.owner.CurrentItem); if (previousItem != null) { this.ProcessSelection(previousItem, Control.ModifierKeys, false); } } }
protected override void HandleRightKey(KeyEventArgs e) { ListViewDataItemGroup group = this.owner.CurrentItem as ListViewDataItemGroup; if (group != null) { group.Expanded = true; } else { ListViewDataItem nextItem = GetNextItem(this.owner.CurrentItem); if (nextItem != null) { this.ProcessSelection(nextItem, Control.ModifierKeys, false); } } }
protected virtual ListViewDataItem GetDownerItem(ListViewDataItem currentItem) { ListViewTraverser enumerator = this.Scroller.Traverser.GetEnumerator() as ListViewTraverser; enumerator.Position = currentItem; int currentItemX = 0; while (enumerator.MovePrevious() && enumerator.Current != null && !enumerator.Current.IsLastInRow) { currentItemX += enumerator.Current.ActualSize.Width; } if (!(currentItem is ListViewDataItemGroup) && currentItem != null) { currentItemX += currentItem.ActualSize.Width / 2; } enumerator.Position = currentItem; while (currentItem != null && !currentItem.IsLastInRow && enumerator.MoveNext() && !enumerator.Current.IsLastInRow) { } int x = 0; while (enumerator.MoveNext()) { if (x + enumerator.Current.ActualSize.Width >= currentItemX) { return(enumerator.Current); } x += enumerator.Current.ActualSize.Width; if (enumerator.Current.IsLastInRow) { break; } } return(null); }
public override TypeConverter.StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { if ((context != null) && (context.Instance != null)) { ListViewDataItem instance = context.Instance as ListViewDataItem; if ((instance != null) && (instance.Owner != null)) { ArrayList values = new ArrayList(); foreach (ListViewDataItemGroup group in instance.Owner.Groups) { values.Add(group.Text); } values.Add(null); return(new TypeConverter.StandardValuesCollection(values)); } } return(null); }
protected override void HandleRightKey(KeyEventArgs e) { ListViewDataItemGroup currentItem = this.Owner.CurrentItem as ListViewDataItemGroup; if (currentItem != null) { currentItem.Expanded = true; } else { ListViewDataItem listViewDataItem = this.Orientation == Orientation.Vertical ? this.GetNextItem(this.Owner.CurrentItem) : this.GetDownerItem(this.Owner.CurrentItem); if (listViewDataItem == null) { return; } this.ProcessSelection(listViewDataItem, Control.ModifierKeys, false); } }
public override TypeConverter.StandardValuesCollection GetStandardValues( ITypeDescriptorContext context) { if (context != null && context.Instance != null) { ListViewDataItem instance = context.Instance as ListViewDataItem; if (instance != null && instance.Owner != null) { ArrayList arrayList = new ArrayList(); foreach (ListViewDataItemGroup group in instance.Owner.Groups) { arrayList.Add((object)group.Text); } arrayList.Add((object)null); return(new TypeConverter.StandardValuesCollection((ICollection)arrayList)); } } return((TypeConverter.StandardValuesCollection)null); }
protected override void EnsureItemVisibleVertical(ListViewDataItem item) { if (this.Orientation == Orientation.Vertical) { base.EnsureItemVisibleVertical(item); } else { if (item == null) { return; } BaseListViewVisualItem element = this.GetElement(item); if (element == null) { this.UpdateLayout(); if (this.ViewElement.Children.Count <= 0) { return; } if (this.GetItemIndex(item) <= this.GetItemIndex(((BaseListViewVisualItem)this.ViewElement.Children[0]).Data)) { this.Scroller.ScrollToItem(item, false); } else { this.EnsureItemVisibleVerticalCore(item); } } else if (element.ControlBoundingRectangle.Right > this.ViewElement.ControlBoundingRectangle.Right) { this.SetScrollValue(this.HScrollBar, this.HScrollBar.Value + (element.ControlBoundingRectangle.Right - this.ViewElement.ControlBoundingRectangle.Right)); } else { if (element.ControlBoundingRectangle.Left >= this.ViewElement.ControlBoundingRectangle.Left) { return; } this.SetScrollValue(this.HScrollBar, this.HScrollBar.Value - (this.ViewElement.ControlBoundingRectangle.Left - element.ControlBoundingRectangle.Left)); } } }
public virtual void UpdateHiddenItems() { this.itemsListView.BeginUpdate(); foreach (ListViewDataItem listViewDataItem in new List <ListViewDataItem>((IEnumerable <ListViewDataItem>) this.hiddenItemsGroup.Items)) { this.itemsListView.Items.Remove(listViewDataItem); } foreach (LayoutControlItemBase hiddenItem in this.layoutControl.HiddenItems) { ListViewDataItem listViewDataItem = new ListViewDataItem(this.GetItemText(hiddenItem)) { Tag = (object)hiddenItem }; listViewDataItem.Image = this.GetItemImage(hiddenItem); this.itemsListView.Items.Add(listViewDataItem); listViewDataItem.Group = this.hiddenItemsGroup; } this.itemsListView.EndUpdate(); this.hiddenItemsGroup.Text = string.Format(this.GetString("CustomizeDialogHiddenItems"), (object)this.hiddenItemsGroup.Items.Count); }
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == null) { throw new ArgumentNullException("destinationType"); } if ((destinationType == typeof(InstanceDescriptor)) && (value is ListViewDataItem)) { ConstructorInfo constructor; ListViewDataItem item = (ListViewDataItem)value; string[] strArray = new string[item.SubItems.Count]; for (int j = 0; j < strArray.Length; j++) { strArray[j] = Convert.ToString(item.SubItems[j]); } if (item.SubItems.Count == 0) { constructor = typeof(ListViewDataItem).GetConstructor(new Type[] { typeof(string) }); if (constructor != null) { return(new InstanceDescriptor(constructor, new object[] { item.Text }, false)); } } constructor = typeof(ListViewDataItem).GetConstructor(new Type[] { typeof(string), typeof(string[]) }); if (constructor != null) { return(new InstanceDescriptor(constructor, new object[] { item.Text, strArray }, false)); } } if ((destinationType == typeof(string)) && (value is ListViewDataItem)) { return(((ListViewDataItem)value).Text); } return(base.ConvertTo(context, culture, value, destinationType)); }
public override object this[ListViewDataItem item] { get { if (item.DataBoundItem == null) { return((object)null); } if (string.IsNullOrEmpty(this.Column.FieldName)) { return((object)null); } return(this.Owner.ListSource.GetBoundValue(item.DataBoundItem, this.Column.FieldName)); } set { if (item.DataBoundItem == null) { return; } this.Owner.ListSource.SetBoundValue((IDataItem)item, this.Column.FieldName, this.Column.Name, value, (string)null); } }
protected virtual ListViewDataItem GetDownerItem(ListViewDataItem currentItem) { ListViewTraverser enumerator = this.Scroller.Traverser.GetEnumerator() as ListViewTraverser; enumerator.Position = (object)currentItem; int num1 = 0; while (enumerator.MovePrevious() && enumerator.Current != null && !enumerator.Current.IsLastInRow) { num1 += this.GetItemFlowOffset(enumerator.Current); } if (!(currentItem is ListViewDataItemGroup) && currentItem != null) { num1 += this.GetItemFlowOffset(currentItem) / 2; } enumerator.Position = (object)currentItem; do { ; }while (currentItem != null && !currentItem.IsLastInRow && (enumerator.MoveNext() && !enumerator.Current.IsLastInRow)); int num2 = 0; while (enumerator.MoveNext()) { if (num2 + this.GetItemFlowOffset(enumerator.Current) >= num1) { return(enumerator.Current); } num2 += this.GetItemFlowOffset(enumerator.Current); if (enumerator.Current.IsLastInRow) { break; } } return((ListViewDataItem)null); }
public ListViewItemCreatingEventArgs(ListViewDataItem item) { this.item = item; }
public ListViewSubDataItemCollection(ListViewDataItem owner) { this.owner = owner; }
public ListViewItemEditorRequiredEventArgs(ListViewDataItem item, Type editorType) : base(editorType) { this.item = item; }
public ListViewItemChangingEventArgs(ListViewDataItem oldItem, ListViewDataItem newItem) { this.oldItem = oldItem; this.newItem = newItem; this.Cancel = false; }
public ListViewItemValueChangingEventArgs(ListViewDataItem item, object newValue, object oldValue) : base(newValue, oldValue) { this.item = item; }
public ListViewItemValueChangedEventArgs(ListViewDataItem item) : base(item) { }
public ListViewItemEditingEventArgs(ListViewDataItem item, IValueEditor editor) : base(item) { this.editor = editor; }
/// <summary> /// Initializes a new instance of the <see cref="ListViewTraversingEventArgs"/> class. /// </summary> /// <param name="content">The content.</param> public ListViewTraversingEventArgs(ListViewDataItem content) : base(content) { this.process = true; }
protected virtual void HandleDragDrop(RadDropEventArgs e) { RadElement hitTarget1 = e.HitTarget as RadElement; BaseListViewVisualItem targetElement = e.HitTarget as BaseListViewVisualItem; BaseListViewElement hitTarget2 = e.HitTarget as BaseListViewElement; if (hitTarget1 != null) { targetElement = this.owner.ViewElement.GetVisualItemAt(hitTarget1.PointToControl(e.DropLocation)); } ListViewDataItem listViewDataItem = targetElement?.Data; bool flag = false; if (listViewDataItem != null) { listViewDataItem.Owner.ListSource.BeginUpdate(); if (this.owner.ViewElement.ShouldDropAfter(targetElement, e.DropLocation)) { ITraverser <ListViewDataItem> enumerator = this.owner.ViewElement.Scroller.Traverser.GetEnumerator() as ITraverser <ListViewDataItem>; enumerator.Position = (object)listViewDataItem; flag = !enumerator.MoveNext(); listViewDataItem = enumerator.Current; } int newIndex = this.owner.ListSource.IndexOf(listViewDataItem); if (this.draggedItems != null) { foreach (ListViewDataItem draggedItem in this.draggedItems) { int oldIndex = this.owner.ListSource.IndexOf(draggedItem); this.owner.ListSource.Move(oldIndex, newIndex); if (oldIndex > newIndex) { ++newIndex; } } } else if (this.draggedItem != null) { int num1 = this.owner.ListSource.IndexOf(this.draggedItem); if (flag) { int num2 = this.owner.ListSource.Count - 1; } else if (num1 < newIndex) { --newIndex; } this.owner.ListSource.Move(this.owner.ListSource.IndexOf(this.draggedItem), newIndex); } listViewDataItem.Owner.ListSource.EndUpdate(); listViewDataItem.Owner.ViewElement.Scroller.UpdateScrollValue(); } else { if (hitTarget2 == null) { return; } hitTarget2.Owner.ListSource.BeginUpdate(); if (this.draggedItems != null) { foreach (ListViewDataItem draggedItem in this.draggedItems) { hitTarget2.Owner.ListSource.Move(this.owner.ListSource.IndexOf(draggedItem), this.owner.ListSource.Count - 1); } } else if (this.draggedItem != null) { hitTarget2.Owner.ListSource.Move(this.owner.ListSource.IndexOf(this.draggedItem), this.owner.ListSource.Count - 1); } hitTarget2.Owner.ListSource.EndUpdate(); hitTarget2.Owner.ViewElement.Scroller.UpdateScrollValue(); } }