protected virtual SizeF ArrangeRightToLeft(SizeF finalSize) { PointF current = new PointF(this.GetClientRectangle(finalSize).Right, 0.0f); float currentBottom = 0.0f; if (this.groupElements != null) { this.ArrangeRightToLeftGroupElements(ref current, ref currentBottom); } float y = currentBottom + (this.GroupElements.Count > 0 ? (float)this.TemplateGroupsBottomDistance : 0.0f); int num = this.GroupElements.Count > 0 ? this.ChildTemplateGroupsHorizontalOffset : 0; for (int index = 0; index < this.childTemplateGroups.Length; ++index) { TemplateGroupsElement childTemplateGroup = this.childTemplateGroups[index]; RectangleF finalRect = new RectangleF(0.0f, y, finalSize.Width - (float)num, childTemplateGroup.DesiredSize.Height); childTemplateGroup.Arrange(finalRect); y += childTemplateGroup.DesiredSize.Height; if (index < this.childTemplateGroups.Length - 1) { y += (float)this.TemplateGroupsBottomDistance; } } return(finalSize); }
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); }
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); }
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); }
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); }
public void UpdateView() { this.scrollViewer.Visibility = ElementVisibility.Hidden; if (this.GridViewElement == null || this.GridViewElement.Template.AllowDragToGroup) { this.Text = LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("GroupingPanelDefaultMessage"); } else { this.Text = string.Empty; } this.UpdateVisibility(); if (this.viewInfo == null) { return; } if (this.tableGroups != null) { this.PanelContainer.Children.Remove((RadElement)this.tableGroups); this.tableGroups.Dispose(); this.tableGroups = (TemplateGroupsElement)null; } this.tableGroups = new TemplateGroupsElement(this, this.viewInfo.ViewTemplate); this.tableGroups.ZIndex = 0; this.tableGroups.Margin = new Padding(5); this.tableGroups.StretchHorizontally = true; this.tableGroups.StretchVertically = true; this.tableGroups.UpdateHierarchy(); if (this.tableGroups.Children.Count == 0) { this.groupHeader.Visibility = ElementVisibility.Collapsed; this.tableGroups.Dispose(); this.tableGroups = (TemplateGroupsElement)null; } else { this.scrollViewer.Visibility = ElementVisibility.Visible; this.groupHeader.Visibility = ElementVisibility.Visible; this.groupHeader.Text = LocalizationProvider <RadGridLocalizationProvider> .CurrentProvider.GetLocalizedString("GroupingPanelHeader"); this.PanelContainer.Children.Add((RadElement)this.tableGroups); this.Text = (string)null; } this.InvalidateMeasure(true); if (this.GridViewElement.SplitMode != RadGridViewSplitMode.None) { this.UpdateLayout(); this.GridViewElement.InitalizeSplitGridSizes(); } this.UpdateSizeGripVisibility(); }
protected virtual void MeasureTemplateGroupElements(SizeF availableSize, ref SizeF sizeNeeded) { int length = this.childTemplateGroups.Length; for (int index = 0; index < length; ++index) { TemplateGroupsElement childTemplateGroup = this.childTemplateGroups[index]; childTemplateGroup.Measure(availableSize); SizeF desiredSize = childTemplateGroup.DesiredSize; int num = this.GroupElements.Count > 0 ? this.ChildTemplateGroupsHorizontalOffset : 0; sizeNeeded.Width = (float)(int)Math.Max(sizeNeeded.Width, desiredSize.Width + (float)num); sizeNeeded.Height += (float)(int)desiredSize.Height; } sizeNeeded.Height += (float)(length * this.TemplateGroupsBottomDistance); }
public GroupFieldElement( TemplateGroupsElement template, GroupDescriptor groupDescription, SortDescriptor sortDescription) : base(template, groupDescription) { this.sortDescription = sortDescription; this.SetSortingIndicator(); this.column = (GridViewColumn)this.TemplateElement.ViewTemplate.Columns[this.sortDescription.PropertyName ?? string.Empty]; if (this.column == null) { return; } this.UpdateButtonVisibility(); this.column.PropertyChanged += new PropertyChangedEventHandler(this.column_PropertyChanged); }
protected override void OnPreviewDropTarget(PreviewDropTargetEventArgs e) { base.OnPreviewDropTarget(e); TemplateGroupsElement dropTarget = e.DropTarget as TemplateGroupsElement; if (dropTarget == null || dropTarget.CanDragOver(e.DragInstance)) { return; } GroupFieldElement dragInstance = e.DragInstance as GroupFieldElement; if (dragInstance != null) { e.DropTarget = (ISupportDrop)dragInstance.TemplateElement; } else { e.DropTarget = (ISupportDrop)dropTarget.GroupPanelElement; } }
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); }
public void UpdateHierarchy() { if (this.template == null) { return; } this.DisposeChildren(); this.UpdateGroups(); List <TemplateGroupsElement> templateGroupsElementList = new List <TemplateGroupsElement>(); for (int index = 0; index < this.template.Templates.Count; ++index) { TemplateGroupsElement templateGroupsElement = new TemplateGroupsElement(this.groupPanelElement, this.template.Templates[index]); templateGroupsElement.UpdateHierarchy(); if (templateGroupsElement.GroupElements.Count != 0 || templateGroupsElement.ChildTemplateGroupsElements.Count != 0) { templateGroupsElementList.Add(templateGroupsElement); this.Children.Add((RadElement)templateGroupsElement); } } this.childTemplateGroups = templateGroupsElementList.ToArray(); }
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); }
public GroupElement(TemplateGroupsElement template, GroupDescriptor groupDescription) : base(template, groupDescription) { }
public GridGroupVisualElement(TemplateGroupsElement template, GroupDescriptor description) { this.templateElement = template; this.description = description; }
public GroupLinkElement(TemplateGroupsElement templateElement) { this.templateElement = templateElement; this.InitializeLinkType(); }