@@ -15,7 +15,7 @@ private class SampleClass : INotifyPropertyChanged
15
15
16
16
private int val ;
17
17
18
- public int Val
18
+ public virtual int Val
19
19
{
20
20
get
21
21
{
@@ -45,6 +45,25 @@ private void OnPropertyChanged([CallerMemberName] string name = "")
45
45
}
46
46
}
47
47
48
+ private class DerivedClass : SampleClass
49
+ {
50
+ public DerivedClass ( int val ) : base ( val )
51
+ {
52
+ }
53
+
54
+ public override int Val
55
+ {
56
+ get
57
+ {
58
+ return 101 ;
59
+ }
60
+
61
+ set
62
+ {
63
+ }
64
+ }
65
+ }
66
+
48
67
[ TestCategory ( "Helpers" ) ]
49
68
[ UITestMethod ]
50
69
public void Test_SourceNcc_CollectionChanged_Add ( )
@@ -110,4 +129,34 @@ public void Test_SourceNcc_CollectionChanged_Remove()
110
129
Assert . IsTrue ( item . GetPropertyChangedEventHandlerSubscriberLength ( ) == 0 ) ;
111
130
}
112
131
}
132
+
133
+ [ TestCategory ( "Helpers" ) ]
134
+ [ UITestMethod ]
135
+ public void Test_DerivedTypesInList ( )
136
+ {
137
+ // Create ref list with elements of different types:
138
+ List < SampleClass > refList = new List < SampleClass > ( ) ;
139
+ for ( int e = 0 ; e < 100 ; e ++ )
140
+ {
141
+ if ( ( e % 2 ) == 1 )
142
+ {
143
+ refList . Add ( new SampleClass ( e ) ) ;
144
+ }
145
+ else
146
+ {
147
+ refList . Add ( new DerivedClass ( e ) ) ;
148
+ }
149
+ }
150
+ ObservableCollection < SampleClass > col = new ObservableCollection < SampleClass > ( ) ;
151
+
152
+ // Add all items to collection:
153
+ foreach ( var item in refList )
154
+ {
155
+ col . Add ( item ) ;
156
+ }
157
+
158
+ // Sort elements using a property that is overriden in the derived class
159
+ AdvancedCollectionView acv = new AdvancedCollectionView ( col , true ) ;
160
+ acv . SortDescriptions . Add ( new SortDescription ( "Val" , SortDirection . Descending ) ) ;
161
+ }
113
162
}
0 commit comments