diff options
Diffstat (limited to 'mcs/class/WindowsBase/System.ComponentModel')
-rw-r--r-- | mcs/class/WindowsBase/System.ComponentModel/GroupDescription.cs | 9 | ||||
-rw-r--r-- | mcs/class/WindowsBase/System.ComponentModel/SortDescriptionCollection.cs | 23 |
2 files changed, 27 insertions, 5 deletions
diff --git a/mcs/class/WindowsBase/System.ComponentModel/GroupDescription.cs b/mcs/class/WindowsBase/System.ComponentModel/GroupDescription.cs index ed9d824c33..edc1a624b2 100644 --- a/mcs/class/WindowsBase/System.ComponentModel/GroupDescription.cs +++ b/mcs/class/WindowsBase/System.ComponentModel/GroupDescription.cs @@ -31,12 +31,15 @@ namespace System.ComponentModel { public abstract class GroupDescription : INotifyPropertyChanged { + readonly ObservableCollection<object> groupNames; + protected GroupDescription () { + groupNames = new ObservableCollection<object> (); } public ObservableCollection<object> GroupNames { - get { throw new NotImplementedException (); } + get { return groupNames; } } event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged { @@ -48,7 +51,7 @@ namespace System.ComponentModel { public virtual bool NamesMatch (object groupName, object itemName) { - throw new NotImplementedException (); + return Equals (groupName, itemName); } protected virtual void OnPropertyChanged (PropertyChangedEventArgs e) @@ -60,7 +63,7 @@ namespace System.ComponentModel { [EditorBrowsable (EditorBrowsableState.Never)] public bool ShouldSerializeGroupNames () { - throw new NotImplementedException (); + return GroupNames.Count != 0; } public abstract object GroupNameFromItem (object item, int level, CultureInfo culture); diff --git a/mcs/class/WindowsBase/System.ComponentModel/SortDescriptionCollection.cs b/mcs/class/WindowsBase/System.ComponentModel/SortDescriptionCollection.cs index 2044bca076..9174cfb445 100644 --- a/mcs/class/WindowsBase/System.ComponentModel/SortDescriptionCollection.cs +++ b/mcs/class/WindowsBase/System.ComponentModel/SortDescriptionCollection.cs @@ -32,10 +32,17 @@ namespace System.ComponentModel { public class SortDescriptionCollection : Collection<SortDescription>, INotifyCollectionChanged { - public static readonly SortDescriptionCollection Empty = new SortDescriptionCollection (); + public static readonly SortDescriptionCollection Empty = new SortDescriptionCollection (true); - public SortDescriptionCollection () + readonly bool isReadOnly; + + public SortDescriptionCollection () : this (false) + { + } + + SortDescriptionCollection (bool isReadOnly) { + this.isReadOnly = isReadOnly; } event NotifyCollectionChangedEventHandler INotifyCollectionChanged.CollectionChanged { @@ -47,12 +54,18 @@ namespace System.ComponentModel { protected override void ClearItems () { + if (isReadOnly) + throw new NotSupportedException (); + base.ClearItems (); OnCollectionChanged (NotifyCollectionChangedAction.Reset); } protected override void InsertItem (int index, SortDescription item) { + if (isReadOnly) + throw new NotSupportedException (); + item.Seal (); base.InsertItem (index, item); OnCollectionChanged (NotifyCollectionChangedAction.Add, item, index); @@ -60,6 +73,9 @@ namespace System.ComponentModel { protected override void RemoveItem (int index) { + if (isReadOnly) + throw new NotSupportedException (); + SortDescription sd = base [index]; base.RemoveItem (index); OnCollectionChanged (NotifyCollectionChangedAction.Remove, sd, index); @@ -67,6 +83,9 @@ namespace System.ComponentModel { protected override void SetItem (int index, SortDescription item) { + if (isReadOnly) + throw new NotSupportedException (); + SortDescription old = base [index]; item.Seal (); base.SetItem (index, item); |