protected override void ProcessDragDrop(Point dropLocation, ISupportDrag dragObject) { GroupFieldDragDropContext dataContext1 = dragObject.GetDataContext() as GroupFieldDragDropContext; if (dataContext1 != null) { dataContext1.ViewTemplate.GroupDescriptors.Remove(dataContext1.GroupDescription); } else { GridViewRowInfo dataContext2 = dragObject.GetDataContext() as GridViewRowInfo; if (dataContext2 != null) { if (this.RowInfo.ViewTemplate.SortDescriptors.Count > 0 || this.RowInfo.ViewTemplate.GroupDescriptors.Count > 0) { return; } bool isDroppedAtLeft = RadGridViewDragDropService.IsDroppedAtTop(dropLocation, this.Size.Height); GridViewTemplate viewTemplate = this.Data.ViewTemplate; int targetIndex = viewTemplate.Rows.IndexOf(this.Data); int draggedItemIndex = viewTemplate.Rows.IndexOf(dataContext2); RadGridViewDragDropService.CalculateTargetIndex(isDroppedAtLeft, viewTemplate.RowCount, ref targetIndex, ref draggedItemIndex); viewTemplate.Rows.Move(draggedItemIndex, targetIndex); } else { base.ProcessDragDrop(dropLocation, dragObject); } } }
protected override void ProcessDragDrop(Point dropLocation, ISupportDrag dragObject) { GroupFieldDragDropContext dataContext = dragObject.GetDataContext() as GroupFieldDragDropContext; if (dataContext != null) { dataContext.ViewTemplate.GroupDescriptors.Remove(dataContext.GroupDescription); } else { base.ProcessDragDrop(dropLocation, dragObject); } }
protected override void ProcessDragDrop(Point dropLocation, ISupportDrag dragObject) { object dataContext = dragObject.GetDataContext(); if (dataContext is GridViewDataColumn) { GridViewColumn gridViewColumn = dataContext as GridViewColumn; GroupDescriptor groupDescription = new GroupDescriptor(); groupDescription.GroupNames.Add(new SortDescriptor(gridViewColumn.Name, ListSortDirection.Ascending)); if (TemplateGroupsElement.RaiseGroupByChanging(gridViewColumn.OwnerTemplate, groupDescription, NotifyCollectionChangedAction.Add)) { return; } gridViewColumn.OwnerTemplate.DataView.GroupDescriptors.Add(groupDescription); TemplateGroupsElement.RaiseGroupByChanged(gridViewColumn.OwnerTemplate, groupDescription, NotifyCollectionChangedAction.Add); } else { if (!(dataContext is GroupFieldDragDropContext)) { return; } GroupFieldDragDropContext fieldDragDropContext = dataContext as GroupFieldDragDropContext; SortDescriptor sortDescription = fieldDragDropContext.SortDescription; GridViewTemplate viewTemplate = fieldDragDropContext.ViewTemplate; GroupDescriptor groupDescription1 = fieldDragDropContext.GroupDescription; if (TemplateGroupsElement.RaiseGroupByChanging(viewTemplate, groupDescription1, NotifyCollectionChangedAction.Batch)) { return; } groupDescription1.GroupNames.Remove(sortDescription); GroupDescriptor groupDescription2 = new GroupDescriptor(); groupDescription2.GroupNames.Add(sortDescription); viewTemplate.GroupDescriptors.Add(groupDescription2); if (groupDescription1.GroupNames.Count == 0) { viewTemplate.DataView.GroupDescriptors.Remove(groupDescription1); } TemplateGroupsElement.RaiseGroupByChanged(viewTemplate, groupDescription2, NotifyCollectionChangedAction.Batch); } }
private void ProcessGroupFieldDrop(Point dropLocation, GroupFieldDragDropContext context) { SortDescriptor sortDescription = context.SortDescription; GridViewTemplate viewTemplate = context.ViewTemplate; GroupDescriptor groupDescription = context.GroupDescription; if (TemplateGroupsElement.RaiseGroupByChanging(viewTemplate, groupDescription, NotifyCollectionChangedAction.Batch) || this.ProcessGroupFieldDropOverride(dropLocation, context)) { return; } groupDescription.GroupNames.Remove(sortDescription); GroupDescriptor groupDescriptor = new GroupDescriptor(); groupDescriptor.GroupNames.Add(sortDescription); RadGridViewDragDropService.InsertOnLeftOrRight <GroupDescriptor>(RadGridViewDragDropService.IsDroppedAtLeft(dropLocation, this.Size.Width), (Collection <GroupDescriptor>) this.description.Owner, this.description, groupDescriptor); if (groupDescription.GroupNames.Count == 0) { viewTemplate.DataView.GroupDescriptors.Remove(groupDescription); } TemplateGroupsElement.RaiseGroupByChanged(viewTemplate, groupDescriptor, NotifyCollectionChangedAction.Batch); }
protected override bool ProcessGroupFieldDropOverride( Point dropLocation, GroupFieldDragDropContext context) { SortDescriptor sortDescription = context.SortDescription; GridViewTemplate viewTemplate = context.ViewTemplate; GroupDescriptor groupDescription = context.GroupDescription; groupDescription.GroupNames.Remove(sortDescription); if (RadGridViewDragDropService.IsDroppedAtLeft(dropLocation, this.Size.Width)) { this.Description.GroupNames.Insert(0, sortDescription); } else { this.Description.GroupNames.Add(sortDescription); } if (groupDescription.GroupNames.Count == 0) { viewTemplate.DataView.GroupDescriptors.Remove(groupDescription); } TemplateGroupsElement.RaiseGroupByChanged(context.ViewTemplate, context.GroupDescription, NotifyCollectionChangedAction.Batch); return(true); }
protected virtual void ProcessDragDropFieldContext(object dataContext) { GroupFieldDragDropContext fieldDragDropContext = dataContext as GroupFieldDragDropContext; GroupDescriptor groupDescription = fieldDragDropContext.GroupDescription; SortDescriptor sortDescription = fieldDragDropContext.SortDescription; GridViewTemplate viewTemplate = fieldDragDropContext.ViewTemplate; if (TemplateGroupsElement.RaiseGroupByChanging(this.template, groupDescription, NotifyCollectionChangedAction.Batch)) { return; } if (groupDescription.GroupNames.Count == 1) { this.ViewTemplate.DataView.GroupDescriptors.Move(this.ViewTemplate.DataView.GroupDescriptors.IndexOf(groupDescription), this.ViewTemplate.DataView.GroupDescriptors.Count - 1); } else { groupDescription.GroupNames.Remove(sortDescription); GroupDescriptor groupDescriptor = new GroupDescriptor(); groupDescriptor.GroupNames.Add(sortDescription); this.ViewTemplate.DataView.GroupDescriptors.Add(groupDescriptor); } TemplateGroupsElement.RaiseGroupByChanged(this.template, groupDescription, NotifyCollectionChangedAction.Batch); }
protected override bool ProcessGroupFieldDropOverride( Point dropLocation, GroupFieldDragDropContext context) { bool isDroppedAtLeft = RadGridViewDragDropService.IsDroppedAtLeft(dropLocation, this.Size.Width); if (this.Description != context.GroupDescription) { SortDescriptor sortDescription = context.SortDescription; GridViewTemplate viewTemplate = context.ViewTemplate; context.GroupDescription.GroupNames.Remove(sortDescription); if (context.GroupDescription.GroupNames.Count == 0) { viewTemplate.DataView.GroupDescriptors.Remove(context.GroupDescription); } RadGridViewDragDropService.InsertOnLeftOrRight <SortDescriptor>(isDroppedAtLeft, (Collection <SortDescriptor>) this.Description.GroupNames, this.sortDescription, sortDescription); } else { RadGridViewDragDropService.MoveOnLeftOrRight <SortDescriptor>(isDroppedAtLeft, (Collection <SortDescriptor>) this.Description.GroupNames, this.sortDescription, context.SortDescription); } TemplateGroupsElement.RaiseGroupByChanged(context.ViewTemplate, context.GroupDescription, NotifyCollectionChangedAction.Batch); return(true); }
protected virtual bool ProcessGroupFieldDropOverride( Point dropLocation, GroupFieldDragDropContext context) { return(false); }