예제 #1
0
 protected override void ProcessColumnDrop(Point dropLocation, GridViewColumn column)
 {
     if (TemplateGroupsElement.RaiseGroupByChanging(this.TemplateElement.ViewTemplate, this.Description, NotifyCollectionChangedAction.ItemChanged))
     {
         return;
     }
     RadGridViewDragDropService.InsertOnLeftOrRight <SortDescriptor>(RadGridViewDragDropService.IsDroppedAtLeft(dropLocation, this.Size.Width), (Collection <SortDescriptor>) this.Description.GroupNames, this.sortDescription, new SortDescriptor(column.Name, ListSortDirection.Ascending));
     TemplateGroupsElement.RaiseGroupByChanged(this.TemplateElement.ViewTemplate, this.Description, NotifyCollectionChangedAction.ItemChanged);
 }
예제 #2
0
        protected virtual void ProcessColumnDrop(Point dropLocation, GridViewColumn column)
        {
            GroupDescriptor groupDescriptor = new GroupDescriptor();

            groupDescriptor.GroupNames.Add(new SortDescriptor(column.Name, ListSortDirection.Ascending));
            if (TemplateGroupsElement.RaiseGroupByChanging(this.templateElement.ViewTemplate, groupDescriptor, NotifyCollectionChangedAction.Add))
            {
                return;
            }
            RadGridViewDragDropService.InsertOnLeftOrRight <GroupDescriptor>(RadGridViewDragDropService.IsDroppedAtLeft(dropLocation, this.Size.Width), (Collection <GroupDescriptor>) this.description.Owner, this.description, groupDescriptor);
            TemplateGroupsElement.RaiseGroupByChanged(this.templateElement.ViewTemplate, groupDescriptor, NotifyCollectionChangedAction.Add);
        }
예제 #3
0
        protected virtual void ProcessDragDropColumn(object dataContext)
        {
            GridViewColumn  gridViewColumn   = dataContext as GridViewColumn;
            GroupDescriptor groupDescription = new GroupDescriptor();

            groupDescription.GroupNames.Add(new SortDescriptor(gridViewColumn.Name, ListSortDirection.Ascending));
            if (TemplateGroupsElement.RaiseGroupByChanging(this.template, groupDescription, NotifyCollectionChangedAction.Add))
            {
                return;
            }
            this.template.DataView.GroupDescriptors.Add(groupDescription);
            TemplateGroupsElement.RaiseGroupByChanged(this.template, groupDescription, NotifyCollectionChangedAction.Add);
        }
예제 #4
0
 private void RemoveButton_Click(object sender, EventArgs e)
 {
     if (TemplateGroupsElement.RaiseGroupByChanging(this.TemplateElement.ViewTemplate, this.Description, NotifyCollectionChangedAction.Remove))
     {
         return;
     }
     if (this.Description.GroupNames.Count == 1)
     {
         this.TemplateElement.ViewTemplate.GroupDescriptors.Remove(this.Description);
     }
     this.Description.GroupNames.Remove(this.sortDescription);
     TemplateGroupsElement.RaiseGroupByChanged(this.TemplateElement.ViewTemplate, this.Description, NotifyCollectionChangedAction.Remove);
 }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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);
        }
예제 #7
0
        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);
        }