Exemplo n.º 1
0
		public void SortDescriptionCollectionAddNoHandlerTest()
		{
			SortDescriptionCollection sdc = new SortDescriptionCollection ();
			SortDescription addedItem = new SortDescription ("A", ListSortDirection.Ascending);

			sdc.Add (addedItem);

			addedItem = sdc[0];

			Assert.AreEqual ("A", addedItem.PropertyName, "ADDN_#1");
			Assert.AreEqual (ListSortDirection.Ascending, addedItem.Direction, "ADDN_#2");
			Assert.AreEqual (true, addedItem.IsSealed, "ADDN_#3");
		}
Exemplo n.º 2
0
        public void SortDescriptionCollectionAddNoHandlerTest()
        {
            SortDescriptionCollection sdc       = new SortDescriptionCollection();
            SortDescription           addedItem = new SortDescription("A", ListSortDirection.Ascending);

            sdc.Add(addedItem);

            addedItem = sdc[0];

            Assert.AreEqual("A", addedItem.PropertyName, "ADDN_#1");
            Assert.AreEqual(ListSortDirection.Ascending, addedItem.Direction, "ADDN_#2");
            Assert.AreEqual(true, addedItem.IsSealed, "ADDN_#3");
        }
Exemplo n.º 3
0
        private void Sort(GridViewColumnHeader columnHeader, ListSortDirection direction)
        {
            ICollectionView           dataView         = CollectionViewSource.GetDefaultView(lsvItems.ItemsSource);
            SortDescriptionCollection sortDescriptions = dataView.SortDescriptions;

            sortDescriptions.Clear();

            if (columnHeader == checkBoxGridViewColumnHeader)
            {
                sortDescriptions.Add(new SortDescription("Enabled", direction));
                sortDescriptions.Add(new SortDescription("Id", ListSortDirection.Ascending));
            }
            else
            {
                string propertyName = columnHeader.Content.ToString();
                sortDescriptions.Add(new SortDescription(propertyName, direction));
            }

            dataView.Refresh();

            if (direction == ListSortDirection.Ascending)
            {
                columnHeader.Column.HeaderTemplate = Resources["gridViewHeaderArrowUpTemplate"] as DataTemplate;
            }
            else
            {
                columnHeader.Column.HeaderTemplate = Resources["gridViewHeaderArrowDownTemplate"] as DataTemplate;
            }

            if (_lastClickedHeader != null &&
                _lastClickedHeader != columnHeader)
            {
                _lastClickedHeader.Column.HeaderTemplate = null;
            }

            _lastClickedHeader = columnHeader;
            _lastDirection     = direction;
        }
Exemplo n.º 4
0
        private static void SortDataGrid(DataGrid dataGrid)
        {
            var sortDescriptions = new SortDescriptionCollection();
            foreach (SortDescription sd in dataGrid.Items.SortDescriptions)
            {
                sortDescriptions.Add(sd);
            }
            dataGrid.Items.SortDescriptions.Clear();

            foreach (SortDescription sd in sortDescriptions)
            {
                dataGrid.Items.SortDescriptions.Add(sd);
            }
        }
Exemplo n.º 5
0
        private void RenderSort(SortDescriptionCollection sorts, GridViewColumn column, ListSortDirection direction)
        {
            Uri uri = new Uri("/Dev2Be.Toolkit;component/Themes/Glyphs.xaml", UriKind.Relative);
            ResourceDictionary dictionary = Application.LoadComponent(uri) as ResourceDictionary;

            column.HeaderTemplate = (DataTemplate)dictionary["HeaderTemplateSort" + direction];

            if (column.DisplayMemberBinding is Binding columnBinding)
            {
                sorts.Clear();
                sorts.Add(new SortDescription(columnBinding.Path.Path, direction));
                lastColumnSorted = column;
            }
        }
Exemplo n.º 6
0
 public void Apply(DataGridColumn column, int gridColumnCount, SortDescriptionCollection sortDescriptions)
 {
     column.Width         = new DataGridLength(WidthValue, WidthType);
     column.SortDirection = SortDirection;
     if (SortDirection != null)
     {
         sortDescriptions.Add(new SortDescription(PropertyPath, SortDirection.Value));
     }
     if (column.DisplayIndex != DisplayIndex)
     {
         var maxIndex = gridColumnCount == 0 ? 0 : gridColumnCount - 1;
         column.DisplayIndex = DisplayIndex <= maxIndex ? DisplayIndex : maxIndex;
     }
 }
Exemplo n.º 7
0
        public StressBindingInfo(DeterministicRandom random)
        {
            libraries = new Library[] { new Library(0.0, random), new Library(0.1, random), new Library(0.2, random) };

            xmlLibraries = new XmlDocument[] { libraries[0].ToXmlDocument(),
                                               libraries[1].ToXmlDocument(),
                                               libraries[2].ToXmlDocument() };

            adoLibraries = new DataTable[] { libraries[0].ToDataTable(),
                                             libraries[1].ToDataTable(),
                                             libraries[2].ToDataTable() };

            sortDescriptionArray = new SortDescriptionCollection[4];

            SortDescriptionCollection sortDescriptionCollection = new SortDescriptionCollection();

            sortDescriptionCollection.Add(new SortDescription("Title", random.NextEnum <ListSortDirection>()));
            sortDescriptionArray[0] = sortDescriptionCollection;

            sortDescriptionCollection = new SortDescriptionCollection();
            sortDescriptionCollection.Add(new SortDescription("Genre", random.NextEnum <ListSortDirection>()));
            sortDescriptionCollection.Add(new SortDescription("Price", random.NextEnum <ListSortDirection>()));
            sortDescriptionArray[1] = sortDescriptionCollection;

            sortDescriptionCollection = new SortDescriptionCollection();
            sortDescriptionCollection.Add(new SortDescription("Price", random.NextEnum <ListSortDirection>()));
            sortDescriptionArray[2] = sortDescriptionCollection;

            sortDescriptionCollection = new SortDescriptionCollection();
            sortDescriptionCollection.Add(new SortDescription("Author", random.NextEnum <ListSortDirection>()));
            sortDescriptionArray[3] = sortDescriptionCollection;

            groupDescriptionArray = new PropertyGroupDescription[3];
            PropertyGroupDescription propertyGroupDescription = new PropertyGroupDescription();

            propertyGroupDescription.PropertyName = "Title";
            groupDescriptionArray[0] = propertyGroupDescription;

            propertyGroupDescription = new PropertyGroupDescription();
            propertyGroupDescription.PropertyName = "Genre";
            groupDescriptionArray[1] = propertyGroupDescription;

            propertyGroupDescription = new PropertyGroupDescription();
            propertyGroupDescription.PropertyName = "Author";
            groupDescriptionArray[2] = propertyGroupDescription;

            CustomFilter myfilter = new CustomFilter();

            filters = new Predicate <object>[] { new Predicate <object>(myfilter.Over50), new Predicate <object>(myfilter.NotOver50) };
        }
Exemplo n.º 8
0
        // 对listview中的配置列表进行排序
        public void SortListViewItems()
        {
            SortDescriptionCollection sdc           = listView.Items.SortDescriptions;
            ListSortDirection         sortDirection = ListSortDirection.Ascending;

            if (sdc.Count > 0)
            {
                SortDescription sd = sdc[0];
                sortDirection = (ListSortDirection)(((int)sd.Direction + 1) % 2);
                sdc.Clear();
            }

            sdc.Add(new SortDescription("Brand", ListSortDirection.Ascending));
        }
Exemplo n.º 9
0
        public void SetDefaultSorts(IEnumerable <SortDescription> sorts)
        {
            //TODO: add support for this
            if (_defaultSorts.Any())
            {
                throw new NotSupportedException("Already added default sorts");
            }

            foreach (var sort in sorts)
            {
                _defaultSorts.Add(new SortDescription(sort.PropertyName, sort.Direction));
            }
            ApplyDefaultSorts();
        }
Exemplo n.º 10
0
        private void GridViewColumnHeader_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                SortDescriptionCollection sortDescriptions = View.SortDescriptions;
                Image  columnSortImage = ((Image)((StackPanel)((GridViewColumnHeader)sender).Content).Children[0]);
                object columnContent   = ((GridViewColumnHeader)sender).Content;

                foreach (GridViewColumn column in ((GridView)listViewMain.View).Columns)
                {
                    if (((GridViewColumnHeader)column.Header).Content.Equals(columnContent))
                    {
                        string propertyName = column.DisplayMemberBinding == null ? "PriorityInt" : ((Binding)column.DisplayMemberBinding).Path.Path;
                        bool   contained    = false;
                        int    position     = 0;

                        for (int i = 0; i < sortDescriptions.Count; i++)
                        {
                            if (sortDescriptions[i].PropertyName.Equals(propertyName))
                            {
                                contained = true;
                                position  = i;

                                break;
                            }
                        }

                        if (!contained)
                        {
                            sortDescriptions.Add(new SortDescription(propertyName, ListSortDirection.Ascending));
                            columnSortImage.Source = new BitmapImage(new Uri(@"/Resources/Images/SortedAscending.png", UriKind.Relative));
                        }
                        else
                        {
                            if (sortDescriptions[position].Direction == ListSortDirection.Ascending)
                            {
                                sortDescriptions.RemoveAt(position);
                                sortDescriptions.Insert(position, new SortDescription(propertyName, ListSortDirection.Descending));
                                columnSortImage.Source = new BitmapImage(new Uri(@"/Resources/Images/SortedDescending.png", UriKind.Relative));
                            }
                            else
                            {
                                sortDescriptions.RemoveAt(position);
                                columnSortImage.Source = new BitmapImage(new Uri(@"/Resources/Images/Unsorted.png", UriKind.Relative));
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 11
0
 private void OnSorting(object sender, DataGridSortingEventArgs e)
 {
     // do special sorting for Name column
     if ((string)e.Column.Header == "Name")
     {
         DataGrid dataGrid = sender as DataGrid;
         SortDescriptionCollection sort = dataGrid.Items.SortDescriptions;
         if (e.Column.SortDirection == ListSortDirection.Ascending)
         {
             e.Column.SortDirection = ListSortDirection.Descending;
             sort.Clear();
             sort.Add(new SortDescription("IsDirectory", ListSortDirection.Descending));
             sort.Add(new SortDescription("Name", ListSortDirection.Ascending));
         }
         else
         {
             e.Column.SortDirection = ListSortDirection.Ascending;
             sort.Clear();
             sort.Add(new SortDescription("IsDirectory", ListSortDirection.Ascending));
             sort.Add(new SortDescription("Name", ListSortDirection.Descending));
         }
         e.Handled = true;
     }
 }
 public void Apply(DataGridColumn column, int gridColumnCount, SortDescriptionCollection sortDescriptions)
 {
     column.Width = new DataGridLength(WidthValue, WidthType);
     column.SortDirection = SortDirection;
     if (SortDirection != null)
     {
         sortDescriptions.Add(new SortDescription(PropertyPath, SortDirection.Value));
     }
     if (column.DisplayIndex != DisplayIndex)
     {
         var maxIndex = (gridColumnCount == 0) ? 0 : gridColumnCount - 1;
         column.DisplayIndex = (DisplayIndex <= maxIndex) ? DisplayIndex : maxIndex;
     }
     column.Visibility = IsVisible ? Visibility.Visible : Visibility.Collapsed;
     column.SortMemberPath = SortMemberPath;
 }
 public void Apply(DataGridColumn column, int gridColumnCount, SortDescriptionCollection sortDescriptions)
 {
     column.Width         = new DataGridLength(WidthValue, WidthType);
     column.SortDirection = SortDirection;
     if (SortDirection != null)
     {
         sortDescriptions.Add(new SortDescription(PropertyPath, SortDirection.Value));
     }
     if (column.DisplayIndex != DisplayIndex)
     {
         var maxIndex = (gridColumnCount == 0) ? 0 : gridColumnCount - 1;
         column.DisplayIndex = (DisplayIndex <= maxIndex) ? DisplayIndex : maxIndex;
     }
     column.Visibility     = IsVisible ? Visibility.Visible : Visibility.Collapsed;
     column.SortMemberPath = SortMemberPath;
 }
        public void SortDescriptionCollectionClearTest()
        {
            SortDescriptionCollection sdc = new SortDescriptionCollection();
            bool eventFired = false;

            sdc.Add(new SortDescription("A", ListSortDirection.Ascending));

            ((INotifyCollectionChanged)sdc).CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e) {
                Assert.AreEqual(NotifyCollectionChangedAction.Reset, e.Action, "CLR_#0");
                eventFired = true;
            };

            sdc.Clear();

            Assert.IsTrue(eventFired, "CLR_#1");
        }
Exemplo n.º 15
0
		public void SortDescriptionCollectionAddTest()
		{
			SortDescriptionCollection sdc = new SortDescriptionCollection ();
			SortDescription addedItem = new SortDescription ("NONE", ListSortDirection.Ascending);

			((INotifyCollectionChanged)sdc).CollectionChanged += delegate (object sender, NotifyCollectionChangedEventArgs e) {
				Assert.AreEqual (NotifyCollectionChangedAction.Add, e.Action, "ADD_#0");
				addedItem = (SortDescription)e.NewItems [0];
				Assert.AreEqual (true, addedItem.IsSealed, "ADD_#0b");
			};

			sdc.Add (new SortDescription ("A", ListSortDirection.Ascending));

			Assert.AreEqual ("A", addedItem.PropertyName, "ADD_#1");
			Assert.AreEqual (ListSortDirection.Ascending, addedItem.Direction, "ADD_#2");
			Assert.AreEqual (true, addedItem.IsSealed, "ADD_#3");
		}
        public void SortDescriptionCollectionAddTest()
        {
            SortDescriptionCollection sdc       = new SortDescriptionCollection();
            SortDescription           addedItem = new SortDescription("NONE", ListSortDirection.Ascending);

            ((INotifyCollectionChanged)sdc).CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e) {
                Assert.AreEqual(NotifyCollectionChangedAction.Add, e.Action, "ADD_#0");
                addedItem = (SortDescription)e.NewItems [0];
                Assert.AreEqual(true, addedItem.IsSealed, "ADD_#0b");
            };

            sdc.Add(new SortDescription("A", ListSortDirection.Ascending));

            Assert.AreEqual("A", addedItem.PropertyName, "ADD_#1");
            Assert.AreEqual(ListSortDirection.Ascending, addedItem.Direction, "ADD_#2");
            Assert.AreEqual(true, addedItem.IsSealed, "ADD_#3");
        }
Exemplo n.º 17
0
        public void SetSealedDirectionTest()
        {
            SortDescription sd = new SortDescription("Test", ListSortDirection.Ascending);

            // Need to borrow the add method of SortDescriptionCollection to seal the
            // SortDescription (Seal is internal)
            SortDescriptionCollection sdc = new SortDescriptionCollection();

            sdc.Add(sd);

            sd = sdc [0];
            // SD is sealed now.
            Assert.IsTrue(sd.IsSealed, "SealedProp_#1");

            sd.Direction = ListSortDirection.Descending;
            Assert.AreEqual(ListSortDirection.Descending, sd.Direction, "SealedProp_#1");
        }
Exemplo n.º 18
0
 public static void Sort(GridViewColumn clickedColumn, ItemCollection itemCollection)
 {
     if (clickedColumn != null)
     {
         //Get binding property of clicked column
         string bindingProperty                  = (clickedColumn.DisplayMemberBinding as Binding).Path.Path;
         SortDescriptionCollection sdc           = itemCollection.SortDescriptions;
         ListSortDirection         sortDirection = ListSortDirection.Ascending;
         if (sdc.Count > 0)
         {
             SortDescription sd = sdc[0];
             sortDirection = sd.Direction == ListSortDirection.Ascending ? ListSortDirection.Descending : ListSortDirection.Ascending;
             sdc.Clear();
         }
         sdc.Add(new SortDescription(bindingProperty, sortDirection));
     }
 }
Exemplo n.º 19
0
        private void SortBy(string propertyName)
        {
            SortDescriptionCollection sorting = this.tasks.Items.SortDescriptions;
            SortDescription           sort;
            int index;

            if (TryGetSortDescription(sorting, propertyName, out sort, out index))
            {
                ListSortDirection direction = sort.Direction == ListSortDirection.Ascending ? ListSortDirection.Descending : ListSortDirection.Ascending;
                sort           = new SortDescription(propertyName, direction);
                sorting[index] = sort;
            }
            else
            {
                sort = new SortDescription(propertyName, ListSortDirection.Ascending);
                sorting.Add(sort);
            }
        }
Exemplo n.º 20
0
        public void SortDescriptionCollectionSetTest()
        {
            SortDescriptionCollection sdc = new SortDescriptionCollection();
            int addEvent = 0, removeEvent = 0;

            SortDescription addedItem   = new SortDescription("NONE", ListSortDirection.Ascending);
            SortDescription removedItem = new SortDescription("NONE", ListSortDirection.Ascending);

            sdc.Add(new SortDescription("A", ListSortDirection.Ascending));

            ((INotifyCollectionChanged)sdc).CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e)
            {
                switch (e.Action)
                {
                case NotifyCollectionChangedAction.Add:
                    addEvent++;
                    addedItem = (SortDescription)e.NewItems [0];
                    break;

                case NotifyCollectionChangedAction.Remove:
                    removeEvent++;
                    removedItem = (SortDescription)e.OldItems [0];
                    break;

                default:
                    Assert.Fail("SET_#0");
                    break;
                }
            };

            sdc [0] = new SortDescription("B", ListSortDirection.Descending);

            Assert.AreEqual(1, addEvent, "SET_#1");
            Assert.AreEqual(1, removeEvent, "SET_#2");

            Assert.AreEqual("A", removedItem.PropertyName, "REM_#1");
            Assert.AreEqual(ListSortDirection.Ascending, removedItem.Direction, "REM_#2");
            Assert.AreEqual(true, removedItem.IsSealed, "REM_#3");

            Assert.AreEqual("B", addedItem.PropertyName, "ADD_#1");
            Assert.AreEqual(ListSortDirection.Descending, addedItem.Direction, "ADD_#2");
            Assert.AreEqual(true, addedItem.IsSealed, "ADD_#3");
        }
        public void SortDescriptionCollectionRemoveTest()
        {
            SortDescriptionCollection sdc         = new SortDescriptionCollection();
            SortDescription           removedItem = new SortDescription("NONE", ListSortDirection.Ascending);

            sdc.Add(new SortDescription("A", ListSortDirection.Ascending));

            ((INotifyCollectionChanged)sdc).CollectionChanged += delegate(object sender, NotifyCollectionChangedEventArgs e) {
                Assert.AreEqual(NotifyCollectionChangedAction.Remove, e.Action, "REM_#0");
                removedItem = (SortDescription)e.OldItems [0];
                Assert.AreEqual(true, removedItem.IsSealed, "REM_#0b");
            };

            sdc.RemoveAt(0);

            Assert.AreEqual("A", removedItem.PropertyName, "REM_#1");
            Assert.AreEqual(ListSortDirection.Ascending, removedItem.Direction, "REM_#2");
            Assert.AreEqual(true, removedItem.IsSealed, "REM_#3");
        }
Exemplo n.º 22
0
		public void SortDescriptionCollectionRemoveTest()
		{
			SortDescriptionCollection sdc = new SortDescriptionCollection ();
			SortDescription removedItem = new SortDescription ("NONE", ListSortDirection.Ascending);

			sdc.Add (new SortDescription ("A", ListSortDirection.Ascending));

			((INotifyCollectionChanged)sdc).CollectionChanged += delegate (object sender, NotifyCollectionChangedEventArgs e) {
				Assert.AreEqual (NotifyCollectionChangedAction.Remove, e.Action, "REM_#0");
				removedItem = (SortDescription)e.OldItems [0];
				Assert.AreEqual (true, removedItem.IsSealed, "REM_#0b");
			};

			sdc.RemoveAt (0);

			Assert.AreEqual ("A", removedItem.PropertyName, "REM_#1");
			Assert.AreEqual (ListSortDirection.Ascending, removedItem.Direction, "REM_#2");
			Assert.AreEqual (true, removedItem.IsSealed, "REM_#3");
		}
Exemplo n.º 23
0
 private void method_28(ListView listView_0, StatisticsCategory statisticsCategory_0)
 {
     if (statisticsCategory_0 != null)
     {
         statisticsCategory_0.Rebuild();
         CollectionView collectionView = (CollectionView)CollectionViewSource.GetDefaultView(listView_0.ItemsSource);
         ObservableCollection <GroupDescription> groupDescriptions = collectionView.GroupDescriptions;
         if (groupDescriptions.Count == 0)
         {
             groupDescriptions.Add(new PropertyGroupDescription("Group"));
         }
         SortDescriptionCollection sortDescriptions = collectionView.SortDescriptions;
         if (sortDescriptions.Count == 0)
         {
             sortDescriptions.Add(new SortDescription("Order", ListSortDirection.Ascending));
         }
         GridView gridView = listView_0.View as GridView;
         gridView.Columns.Clear();
         int num = 0;
         foreach (string header in statisticsCategory_0.ColumnNames)
         {
             FrameworkElementFactory frameworkElementFactory = new FrameworkElementFactory(typeof(TextBlock));
             GridViewColumn          gridViewColumn          = new GridViewColumn
             {
                 Header       = header,
                 CellTemplate = new DataTemplate
                 {
                     VisualTree = frameworkElementFactory
                 }
             };
             frameworkElementFactory.SetBinding(TextBlock.TextProperty, new Binding(string.Format("Cells[{0}].Value", num)));
             frameworkElementFactory.SetValue(TextBlock.TextWrappingProperty, TextWrapping.NoWrap);
             frameworkElementFactory.SetValue(TextBlock.TextTrimmingProperty, TextTrimming.None);
             frameworkElementFactory.SetValue(TextBlock.TextAlignmentProperty, TextAlignment.Right);
             frameworkElementFactory.AddHandler(FrameworkElement.SizeChangedEvent, this.CellTextBlock_SizeChangedHandler);
             frameworkElementFactory.SetValue(FrameworkElement.TagProperty, gridViewColumn);
             gridView.Columns.Add(gridViewColumn);
             num++;
         }
         collectionView.Refresh();
     }
 }
Exemplo n.º 24
0
 private void List_OnClick(object sender, RoutedEventArgs e)
 {
     if (e.OriginalSource is GridViewColumnHeader)
     {
         GridViewColumn clickedColumn = (e.OriginalSource as GridViewColumnHeader).Column;
         if (clickedColumn != null)
         {
             string bindingProperty                  = (clickedColumn.DisplayMemberBinding as Binding).Path.Path;
             SortDescriptionCollection sdc           = this.list.Items.SortDescriptions;
             ListSortDirection         sortDirection = ListSortDirection.Ascending;
             if (sdc.Count > 0)
             {
                 SortDescription sd = sdc[0];
                 sortDirection = (ListSortDirection)((((int)sd.Direction) + 1) % 2);
                 sdc.Clear();
             }
             sdc.Add(new SortDescription(bindingProperty, sortDirection));
         }
     }
 }
Exemplo n.º 25
0
        public static void SaveSortDataGrid(DataGrid dg)
        {
            SortQueueColumns = new Queue <ListSortDirection?>
                               (
                // Здесь происходит инициализация новой коллекции
                // dg.Columns - это коллекция колонок, что-то вроде динамического массива
                // Если вызвать метод Select, то можно привести все объекты коллекции к другому виду
                // tmp - это любой объект коллекции. Это название может быть любым другим (Не может повторять названия уже объвяленных переменных)
                // После знака '=>' (Лямбда-оператор) написанно к какому виду привести все объекты коллекции
                // В данном случае select вернёт новую коллекцию содержащую направление каждой колонки
                dg.Columns.Select(tmp => tmp.SortDirection)
                               );
            // Объявление коллекции, которая в будущем будет хранить сортировку каждой колонки до обновления таблицы данных
            SortList = new SortDescriptionCollection();

            // Добавляет в коллекцию SortList сортировку каждой колонки до обновления таблицы данных
            foreach (var j in dg.Items.SortDescriptions)
            {
                SortList.Add(j);
            }
        }
Exemplo n.º 26
0
        private void SpeedListView_OnClick(object sender, RoutedEventArgs e)
        {
            if (e.OriginalSource is GridViewColumnHeader header)
            {
                //获得点击的列
                GridViewColumn clickedColumn = header.Column;
                if (clickedColumn != null)
                {
                    string bindingProperty = (clickedColumn.DisplayMemberBinding as Binding).Path.Path;
                    SortDescriptionCollection sortDescription = SpeedListView.Items.SortDescriptions;

                    ListSortDirection sortDirection = ListSortDirection.Ascending;
                    if (sortDescription.Count > 0)
                    {
                        SortDescription sort = sortDescription[0];
                        sortDirection = (ListSortDirection)(((int)sort.Direction + 1) % 2);
                        sortDescription.Clear();
                    }
                    sortDescription.Add(new SortDescription(bindingProperty, sortDirection));
                }
            }
        }
Exemplo n.º 27
0
 private void lvServices_GridViewColumnHeader_Click(object sender, RoutedEventArgs e)
 {
     if (e.OriginalSource is GridViewColumnHeader)
     {
         //Get clicked column
         GridViewColumn clickedColumn = (e.OriginalSource as GridViewColumnHeader).Column;
         if (clickedColumn != null)
         {
             //Get binding property of clicked column
             string bindingProperty                  = (clickedColumn.DisplayMemberBinding as System.Windows.Data.Binding).Path.Path;
             SortDescriptionCollection sdc           = lvServices.Items.SortDescriptions;
             ListSortDirection         sortDirection = ListSortDirection.Ascending;
             if (sdc.Count > 0)
             {
                 SortDescription sd = sdc[0];
                 sortDirection = (ListSortDirection)((((int)sd.Direction) + 1) % 2);
                 sdc.Clear();
             }
             sdc.Add(new SortDescription(bindingProperty, sortDirection));
         }
     }
 }
Exemplo n.º 28
0
        public static DataGridSortDescription SaveSorting(DataGrid grid, ICollectionView view)
        {
            DataGridSortDescription sortDescription = new DataGridSortDescription();

            //Save the current sort order of the columns
            SortDescriptionCollection sortDescriptions = new SortDescriptionCollection();
            if (view != null)
            {
                view.SortDescriptions.ToList().ForEach(sd => sortDescriptions.Add(sd));
            }
            sortDescription.SortDescription = sortDescriptions;

            //save the sort directions (these define the little arrow on the column header...)
            IDictionary<DataGridColumn, ListSortDirection?> sortDirections = new Dictionary<DataGridColumn, ListSortDirection?>();
            foreach (DataGridColumn c in grid.Columns)
            {
                sortDirections.Add(c, c.SortDirection);
            }
            sortDescription.SortDirection = sortDirections;

            return sortDescription;
        }
Exemplo n.º 29
0
        private IQueryable SortQueryable(IQueryable queryable, bool reverseSort)
        {
            DataGridVirtualizingCollectionViewBase parentCollectionView = this.GetCollectionView();

            Debug.Assert(parentCollectionView != null);

            SortDescriptionCollection explicitSortDescriptions = parentCollectionView.SortDescriptions;

            ListSortDirection directionToUseForImplicitSortDescriptions = ListSortDirection.Ascending;

            if (explicitSortDescriptions.Count > 0)
            {
                directionToUseForImplicitSortDescriptions = explicitSortDescriptions[explicitSortDescriptions.Count - 1].Direction;
            }

            SortDescriptionCollection implicitSortDescriptions = new SortDescriptionCollection();

            DataGridVirtualizingQueryableCollectionViewGroupRoot groupRoot =
                parentCollectionView.RootGroup as DataGridVirtualizingQueryableCollectionViewGroupRoot;

            Debug.Assert(groupRoot != null);

            string[] primaryKeys = groupRoot.PrimaryKeys;

            if (primaryKeys != null)
            {
                for (int i = 0; i < primaryKeys.Length; i++)
                {
                    string primaryKey = primaryKeys[i];

                    Debug.Assert(!string.IsNullOrEmpty(primaryKey));

                    implicitSortDescriptions.Add(new SortDescription(primaryKey, directionToUseForImplicitSortDescriptions));
                }
            }

            return(queryable.OrderBy(implicitSortDescriptions, explicitSortDescriptions, reverseSort));
        }
Exemplo n.º 30
0
        public static DataGridSortDescription SaveSorting(DataGrid grid)
        {
            DataGridSortDescription sortDescription = new DataGridSortDescription();

            //Save the current sort order of the columns
            ICollectionView view = CollectionViewSource.GetDefaultView(grid.ItemsSource);
            SortDescriptionCollection sortDescriptions = new SortDescriptionCollection();
            if (view != null)
            {
                view.SortDescriptions.ToList().ForEach(sd => sortDescriptions.Add(sd));
            }
            sortDescription.SortDescription = sortDescriptions;

            //save the sort directions (these define the little arrow on the column header...)
            IDictionary<DataGridColumn, ListSortDirection?> sortDirections = new Dictionary<DataGridColumn, ListSortDirection?>();
            foreach (DataGridColumn c in grid.Columns)
            {
                sortDirections.Add(c, c.SortDirection);
            }
            sortDescription.SortDirection = sortDirections;

            return sortDescription;
        }
Exemplo n.º 31
0
        private void GridViewColumnHeader_Click(object sender, RoutedEventArgs e)
        {
            if (e.OriginalSource is GridViewColumnHeader)
            {
                //Get clicked column
                GridViewColumn clickedColumn = (e.OriginalSource as GridViewColumnHeader).Column;
                if (clickedColumn != null)
                {
                    //Get binding property of clicked column
                    string bindingProperty                  = (clickedColumn.DisplayMemberBinding as Binding).Path.Path;
                    SortDescriptionCollection sdc           = this.lvDirectory.Items.SortDescriptions;
                    ListSortDirection         sortDirection = ListSortDirection.Ascending;
                    if (sdc.Count > 0)
                    {
                        SortDescription sd = sdc[0];
                        sortDirection = (ListSortDirection)((((int)sd.Direction) + 1) % 2);
                        sdc.Clear();
                    }
                    RemoveUPNode();
                    sdc.Add(new SortDescription(bindingProperty, sortDirection));
                    AddUPNode();

                    GridViewColumnHeader headerClicked = e.OriginalSource as GridViewColumnHeader;

                    if (sortDirection == ListSortDirection.Ascending)
                    {
                        headerClicked.Column.HeaderTemplate =
                            Resources["ListViewHeaderTemplateDescendingSorting"] as DataTemplate;
                    }
                    else
                    {
                        headerClicked.Column.HeaderTemplate =
                            Resources["ListViewHeaderTemplateAscendingSorting"] as DataTemplate;
                    }
                }
            }
        }
Exemplo n.º 32
0
            public void Apply(DataGridColumn column, int gridColumnCount, SortDescriptionCollection sortDescriptions)
            {
                column.Width         = new DataGridLength(this.WidthValue, this.WidthType);
                column.SortDirection = this.SortDirection;
                column.Visibility    = this.Visibility;

                if (this.SortDirection.HasValue)
                {
                    sortDescriptions.Add(new SortDescription(this.PropertyPath, this.SortDirection.Value));
                }

                if (column.DisplayIndex != this.DisplayIndex)
                {
                    var maxIndex = (gridColumnCount == 0) ? 0 : gridColumnCount - 1;
                    if (this.DisplayIndex < 0)
                    {
                        column.DisplayIndex = maxIndex;
                    }
                    else
                    {
                        column.DisplayIndex = (this.DisplayIndex <= maxIndex) ? this.DisplayIndex : maxIndex;
                    }
                }
            }
Exemplo n.º 33
0
 private void allProcessesListView_Click(object sender, RoutedEventArgs e)
 {
     if (e.OriginalSource is GridViewColumnHeader)
     {
         //获取点击的头列
         GridViewColumn clickedColumn = (e.OriginalSource as GridViewColumnHeader).Column;
         if (clickedColumn != null && clickedColumn.Header.ToString() != "选择")
         {
             //获取绑定属性
             string bindingProperty;
             bindingProperty = (clickedColumn.DisplayMemberBinding as Binding).Path.Path;
             SortDescriptionCollection sdc           = allProcessesListView.Items.SortDescriptions;
             ListSortDirection         sortDirection = ListSortDirection.Ascending;
             if (sdc.Count > 0)
             {
                 SortDescription sd = sdc[0];
                 sortDirection = (ListSortDirection)((((int)sd.Direction) + 1) % 2);
                 sdc.Clear();
             }
             if (sortDirection == ListSortDirection.Ascending)
             {
                 clickedColumn.HeaderTemplate = Resources["HeaderTemplateArrowUp"] as DataTemplate;
             }
             else if (sortDirection == ListSortDirection.Descending)
             {
                 clickedColumn.HeaderTemplate = Resources["HeaderTemplateArrowDown"] as DataTemplate;
             }
             if (_lastHeaderClicked != null && _lastHeaderClicked != clickedColumn)
             {
                 _lastHeaderClicked.HeaderTemplate = null;
             }
             sdc.Add(new SortDescription(bindingProperty, sortDirection));
             _lastHeaderClicked = clickedColumn;
         }
     }
 }
Exemplo n.º 34
0
        public void Apply(DataGridColumn column, int gridColumnCount, SortDescriptionCollection sortDescriptions)
        {
            if (column == null)
            {
                throw new ArgumentNullException(nameof(column));
            }
            if (sortDescriptions == null)
            {
                throw new ArgumentNullException(nameof(sortDescriptions));
            }

            column.Visibility    = Visibility;
            column.Width         = new DataGridLength(WidthValue, WidthType);
            column.SortDirection = SortDirection;
            if (SortDirection != null)
            {
                sortDescriptions.Add(new SortDescription(PropertyPath, SortDirection.Value));
            }
            if (column.DisplayIndex != DisplayIndex)
            {
                var maxIndex = (gridColumnCount == 0) ? 0 : gridColumnCount - 1;
                column.DisplayIndex = (DisplayIndex <= maxIndex) ? DisplayIndex : maxIndex;
            }
        }
      private void SynchronizeDetailSortDescriptions( SortDescriptionCollection masterSortDescriptions, SortDescriptionCollection detailSortDescriptions,
                                                      FieldNameMap itemPropertyMap )
      {
        ColumnSortCommand.ThrowIfNull( masterSortDescriptions, "masterSortDescriptions" );
        ColumnSortCommand.ThrowIfNull( detailSortDescriptions, "detailSortDescriptions" );
        ColumnSortCommand.ThrowIfNull( itemPropertyMap, "itemPropertyMap" );

        int masterSortDescriptionsCount = masterSortDescriptions.Count;
        if( masterSortDescriptionsCount > 0 )
        {
          int insertionIndex = 0;

          for( int i = 0; i < masterSortDescriptionsCount; i++ )
          {
            var sortDescription = masterSortDescriptions[ i ];

            string detailPropertyName;
            if( !itemPropertyMap.TryGetItemPropertyName( sortDescription.PropertyName, out detailPropertyName ) )
              continue;

            var detailDirection = sortDescription.Direction;

            if( insertionIndex < detailSortDescriptions.Count )
            {
              var detailSortDescription = detailSortDescriptions[ insertionIndex ];

              if( ( detailSortDescription.PropertyName != detailPropertyName ) || ( detailSortDescription.Direction != detailDirection ) )
              {
                detailSortDescriptions[ insertionIndex ] = new SortDescription( detailPropertyName, detailDirection );
              }
            }
            else
            {
              detailSortDescriptions.Add( new SortDescription( detailPropertyName, detailDirection ) );
            }

            insertionIndex++;
          }

          while( insertionIndex < detailSortDescriptions.Count )
          {
            detailSortDescriptions.RemoveAt( insertionIndex );
          }
        }
        else if( detailSortDescriptions.Count > 0 )
        {
          detailSortDescriptions.Clear();
        }
      }
 /// <summary>
 /// Resets the <paramref name="sortDescriptions"/> collection to match the <paramref name="sortDescriptors"/> collection.
 /// </summary>
 /// <param name="sortDescriptions">The collection to reset</param>
 /// <param name="sortDescriptors">The collection to match</param>
 private static void ResetToSortDescriptors(SortDescriptionCollection sortDescriptions, SortDescriptorCollection sortDescriptors)
 {
     sortDescriptions.Clear();
     foreach (SortDescriptor descriptor in sortDescriptors)
     {
         SortDescription? description = SortCollectionManager.GetDescriptionFromDescriptor(descriptor);
         if (description.HasValue)
         {
             sortDescriptions.Add(description.Value);
         }
     }
 }
Exemplo n.º 37
0
 public void Apply(DataGridColumn column, int gridColumnCount, SortDescriptionCollection sortDescriptions) {
     column.Width = new DataGridLength(WidthValue, WidthType);
     column.SortDirection = SortDirection;
     if (SortDirection != null)
         sortDescriptions.Add(new SortDescription(PropertyPath, SortDirection.Value));
     if (column.DisplayIndex != DisplayIndex) {
         var maxIndex = (gridColumnCount == 0) ? 0 : gridColumnCount - 1;
         column.DisplayIndex = (DisplayIndex <= maxIndex) ? DisplayIndex : maxIndex;
     }
 }
Exemplo n.º 38
0
 public static void AddOnly(this SortDescriptionCollection collection, SortDescription sortDescription)
 {
     collection.Clear();
     collection.Add(sortDescription);
 }
Exemplo n.º 39
0
		public void SortDescriptionCollectionClearTest()
		{
			SortDescriptionCollection sdc = new SortDescriptionCollection ();
			bool eventFired = false;

			sdc.Add (new SortDescription ("A", ListSortDirection.Ascending));

			((INotifyCollectionChanged)sdc).CollectionChanged += delegate (object sender, NotifyCollectionChangedEventArgs e) {
				Assert.AreEqual (NotifyCollectionChangedAction.Reset, e.Action, "CLR_#0");
				eventFired = true;
			};

			sdc.Clear ();

			Assert.IsTrue (eventFired, "CLR_#1");
		}
Exemplo n.º 40
0
        private void RenderSort(SortDescriptionCollection sorts, GridViewColumn column, ListSortDirection direction)
        {
            column.HeaderTemplate = (DataTemplate)ListViewOutput.FindResource("HeaderTemplate" + direction);

            Binding columnBinding = column.DisplayMemberBinding as Binding;
            if (columnBinding != null) {
                sorts.Clear();
                sorts.Add(new SortDescription(columnBinding.Path.Path, direction));
                _lastColumnSorted = column;
            }
        }
Exemplo n.º 41
0
        /// <summary>
        /// Renders the triangle next to the columns header
        /// </summary>
        /// <param name="sorts">The SortDescriptions of the Items of the ListView</param>
        /// <param name="column">The column that was clicked on</param>
        /// <param name="direction">The Sort Direction</param>
        /// <param name="lastColumnSorted">The last column that was sorted</param>
        private static void RenderSort(SortDescriptionCollection sorts, GridViewColumn column, ListSortDirection direction, ref GridViewColumn lastColumnSorted)
        {
            if (column == null) return;
            column.HeaderTemplate = (DataTemplate)App.Current.FindResource("HeaderTemplate" + direction);

            System.Windows.Data.Binding columnBinding = column.DisplayMemberBinding as System.Windows.Data.Binding;
            if (columnBinding != null)
            {
                sorts.Clear();
                sorts.Add(new SortDescription(columnBinding.Path.Path, direction));
                lastColumnSorted = column;
            }
        }
    private IQueryable SortQueryable( IQueryable queryable, bool reverseSort )
    {
      DataGridVirtualizingCollectionViewBase parentCollectionView = this.GetCollectionView();

      Debug.Assert( parentCollectionView != null );

      SortDescriptionCollection explicitSortDescriptions = parentCollectionView.SortDescriptions;

      ListSortDirection directionToUseForImplicitSortDescriptions = ListSortDirection.Ascending;

      if( explicitSortDescriptions.Count > 0 )
        directionToUseForImplicitSortDescriptions = explicitSortDescriptions[ explicitSortDescriptions.Count - 1 ].Direction;

      SortDescriptionCollection implicitSortDescriptions = new SortDescriptionCollection();

      DataGridVirtualizingQueryableCollectionViewGroupRoot groupRoot =
        parentCollectionView.RootGroup as DataGridVirtualizingQueryableCollectionViewGroupRoot;

      Debug.Assert( groupRoot != null );

      string[] primaryKeys = groupRoot.PrimaryKeys;

      if( primaryKeys != null )
      {
        for( int i = 0; i < primaryKeys.Length; i++ )
        {
          string primaryKey = primaryKeys[ i ];

          Debug.Assert( !string.IsNullOrEmpty( primaryKey ) );

          implicitSortDescriptions.Add( new SortDescription( primaryKey, directionToUseForImplicitSortDescriptions ) );
        }
      }

      return queryable.OrderBy( implicitSortDescriptions, explicitSortDescriptions, reverseSort );
    }
Exemplo n.º 43
0
        private void Label_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Label             lb = (Label)sender;
            string            bindingProperty = "";
            ListSortDirection sortDirection   = ListSortDirection.Ascending;
            string            strn            = (string)(lb.Tag);

            if (strn == "0")
            {
                if (Paixiflag[0] == 0)
                {
                    Paixiflag[0]  = 1;
                    sortDirection = ListSortDirection.Ascending;
                }
                else
                {
                    Paixiflag[0]  = 0;
                    sortDirection = ListSortDirection.Descending;
                }
                bindingProperty = "Id";
            }
            else if (strn == "1")
            {
                if (Paixiflag[1] == 0)
                {
                    Paixiflag[1]  = 1;
                    sortDirection = ListSortDirection.Ascending;
                }
                else
                {
                    Paixiflag[1]  = 0;
                    sortDirection = ListSortDirection.Descending;
                }
                bindingProperty = "Activated";
            }
            else if (strn == "2")
            {
                if (Paixiflag[2] == 0)
                {
                    Paixiflag[2]  = 1;
                    sortDirection = ListSortDirection.Ascending;
                }
                else
                {
                    Paixiflag[2]  = 0;
                    sortDirection = ListSortDirection.Descending;
                }
                bindingProperty = "Name";
            }
            //else if (strn == "3")
            //{
            //    if (Paixiflag[3] == 0)
            //    {
            //        Paixiflag[3] = 1;
            //        sortDirection = ListSortDirection.Ascending;
            //    }
            //    else
            //    {
            //        Paixiflag[3] = 0;
            //        sortDirection = ListSortDirection.Descending;
            //    }
            //    bindingProperty = "BgColor";
            //}
            else if (strn == "4")
            {
                if (Paixiflag[4] == 0)
                {
                    Paixiflag[4]  = 1;
                    sortDirection = ListSortDirection.Ascending;
                }
                else
                {
                    Paixiflag[4]  = 0;
                    sortDirection = ListSortDirection.Descending;
                }
                bindingProperty = "SinglePump";
            }
            else if (strn == "5")
            {
                if (Paixiflag[5] == 0)
                {
                    Paixiflag[5]  = 1;
                    sortDirection = ListSortDirection.Ascending;
                }
                else
                {
                    Paixiflag[5]  = 0;
                    sortDirection = ListSortDirection.Descending;
                }
                bindingProperty = "DoublePump";
            }
            else if (strn == "6")
            {
                if (Paixiflag[6] == 0)
                {
                    Paixiflag[6]  = 1;
                    sortDirection = ListSortDirection.Ascending;
                }
                else
                {
                    Paixiflag[6]  = 0;
                    sortDirection = ListSortDirection.Descending;
                }
                bindingProperty = "Description";
            }
            SortDescriptionCollection sdc = ListViewTreatMethod.Items.SortDescriptions;

            if (sdc.Count > 0)
            {
                SortDescription sd = sdc[0];
                sortDirection = (ListSortDirection)((((int)sd.Direction) + 1) % 2);
                //判断此列当前的排序方式:升序0,倒序1,并取反进行排序。
                sdc.Clear();
            }

            sdc.Add(new SortDescription(bindingProperty, sortDirection));
            var temp = new ObservableCollection <TreatMethodData>();

            for (int i = 0; i < ListViewTreatMethod.Items.Count; i++)
            {
                temp.Add((TreatMethodData)ListViewTreatMethod.Items[i]);
            }
            Datalist.Clear();
            Datalist = temp;
            ListViewTreatMethod.ItemsSource = Datalist;
            sdc.Clear();
        }
    private void LoadView() {
      // Create and start loading the PCV.

      // Neither EQPCV nor PCV will work with anonymous types.
      if (AnonymousFns.IsAnonymousType(Query.ElementType)) {
        throw new NotSupportedException("Anonymous types are not currently supported.  To work around this limitation, you can instead project into a custom type.");
      }

      if (IsEntityQuery) {
        EntityManager.GetEntityGroup(Query.ElementType).EntityChanged += ObjectDataSource_EntityChanged;
      }

      IsLoadingData = true;
      HasChanges = false;

      // Convert from our "descriptors" to the "descriptions" known by a PCV.
      var sortFields = new SortDescriptionCollection();
      SortDescriptors.ForEach(s => sortFields.Add(s.ToSortDescription()));
      var groupFields = new ObservableCollection<GroupDescription>();
      GroupDescriptors.ForEach(g => groupFields.Add(g.ToGroupDescription()));

      // We'll use an EQPCV or PCV depending on a few factors: 1) an EntityQuery (so we can issue skip/take, 2) paging
      bool useEqpcv = Query is EntityQuery && PageSize > 0;

      if (useEqpcv) {
        EntityQueryPagedCollectionView pcv = null;
        var query = Query as EntityQuery;
        var filter = GetQueryFilter();
        if (sortFields.Count > 0 || groupFields.Count > 0) {
          pcv = new EntityQueryPagedCollectionView(query, PageSize, LoadSize, sortFields, groupFields, filter);
        } else {
          pcv = new EntityQueryPagedCollectionView(query, PageSize, LoadSize, true, true);
          pcv.SetQueryFilter(filter);
          pcv.Refresh();
        }
        Data = pcv;
        DataView = pcv;

      } else {
        // Use the standard PagedCollectionView (when paging isn't wanted or not an EntityQuery)
        IEntityQuery query = Query;
        if (Query is EntityQuery) {
          query = GetFilteredQuery();
        }
        EntityManager.ExecuteQueryAsync(query, args => {
          PagedCollectionView pcv = new PagedCollectionView(args.Results);
          sortFields.ForEach(d => pcv.SortDescriptions.Add(d));
          groupFields.ForEach(d => pcv.GroupDescriptions.Add(d));
          pcv.PageSize = PageSize;
          Data = pcv;
          DataView = pcv;
        });
      }
    }
 /// <summary>
 /// Copies the <paramref name="from"/> collection to the <paramref name="to"/> collection
 /// </summary>
 /// <param name="from">The sort descriptions to copy from</param>
 /// <param name="to">The sort descriptions to copy to</param>
 private static void CopySortDescriptions(SortDescriptionCollection from, SortDescriptionCollection to)
 {
     to.Clear();
     foreach (SortDescription sd in from)
     {
         to.Add(sd);
     }
 }
Exemplo n.º 46
0
		public void SetSealedDirectionTest() {
			SortDescription sd = new SortDescription ("Test", ListSortDirection.Ascending);

			// Need to borrow the add method of SortDescriptionCollection to seal the
			// SortDescription (Seal is internal)
			SortDescriptionCollection sdc = new SortDescriptionCollection ();
			sdc.Add (sd);

			sd = sdc [0];
			// SD is sealed now.
			Assert.IsTrue(sd.IsSealed, "SealedProp_#1");

			sd.Direction = ListSortDirection.Descending;
			Assert.AreEqual (ListSortDirection.Descending, sd.Direction, "SealedProp_#1");
		}
Exemplo n.º 47
0
		public void SortDescriptionCollectionSetTest()
		{
			SortDescriptionCollection sdc = new SortDescriptionCollection ();
			int addEvent = 0, removeEvent = 0;

			SortDescription addedItem = new SortDescription ("NONE", ListSortDirection.Ascending);
			SortDescription removedItem = new SortDescription ("NONE", ListSortDirection.Ascending);

			sdc.Add (new SortDescription ("A", ListSortDirection.Ascending));

			((INotifyCollectionChanged)sdc).CollectionChanged += delegate (object sender, NotifyCollectionChangedEventArgs e) {
				switch (e.Action) {
					case NotifyCollectionChangedAction.Add:
						addEvent++;
						addedItem = (SortDescription)e.NewItems [0];
						break;
					case NotifyCollectionChangedAction.Remove:
						removeEvent++;
						removedItem = (SortDescription)e.OldItems [0];
						break;
					default:
						Assert.Fail ("SET_#0");
						break;
				}
			};

			sdc [0] = new SortDescription ("B", ListSortDirection.Descending);

			Assert.AreEqual (1, addEvent, "SET_#1");
			Assert.AreEqual (1, removeEvent, "SET_#2");

			Assert.AreEqual ("A", removedItem.PropertyName, "REM_#1");
			Assert.AreEqual (ListSortDirection.Ascending, removedItem.Direction, "REM_#2");
			Assert.AreEqual (true, removedItem.IsSealed, "REM_#3");

			Assert.AreEqual ("B", addedItem.PropertyName, "ADD_#1");
			Assert.AreEqual (ListSortDirection.Descending, addedItem.Direction, "ADD_#2");
			Assert.AreEqual (true, addedItem.IsSealed, "ADD_#3");
		}