Esempio n. 1
0
        internal void AddGroupDropAreaItem(GridColumn column, object direction, bool needToGroup)
        {
            if (this.Panel != null && this.Panel.Children.ToList <GroupDropAreaItem>().All(item => (item as GroupDropAreaItem).GridColumn.MappingName != column.MappingName) && this.dataGrid.View != null)
            {
                if (column.MappingName == null)
                {
                    throw new InvalidOperationException("MappingName is necessary for Sorting, Grouping and Filtering");
                }

                //if the column is dummy, we need to restrict it and avoid to add that column in groupdroparea.
                if (!dataGrid.CheckColumnNameinItemProperties(column) && !column.IsUnbound)
                {
                    return;
                }

                var content = this.CreateGroupDropAreaItem(column);
                content.SortDirection = direction;
                this.Panel.Children.Add(content);
                if (needToGroup)
                {
                    this.dataGrid.GroupBy(column.MappingName, null, null);
                }
                this.WatermarkTextVisibility = Visibility.Collapsed;
            }
            else
#if !WPF
            { this.dataGrid.GridColumnDragDropController.reverseAnimationStoryboard.Begin(); }
#else
            { this.dataGrid.GridColumnDragDropController.DraggablePopup.IsOpen = false; }
#endif
        }