Hello,
I'm using my own Collection Implementation and bind this to GridView
I have an exception in FireCollectionChanged Funktion:
---------------------------
Index must be within the bounds of the List.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.Collections.Generic.List`1.Insert(Int32 index, T item)
at Telerik.Windows.Data.KeyedCollection.Insert(Int32 index, Object value) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\KeyedCollection.cs:line 179
at Telerik.Windows.Data.QueryableCollectionView.ProcessSynchronousCollectionChanged(NotifyCollectionChangedEventArgs args) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 1476
at Telerik.Windows.Data.QueryableCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 1340
at Telerik.Windows.Data.QueryableCollectionView.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 1817
at Telerik.Windows.Data.QueryableCollectionView.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 1797
at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\WeakEvents\WeakEvent.cs:line 33
at FileExplorer.ViewModel.BindingTypedList`1.FireCollectionChanged(IList`1 items) in D:\Y\IZTMediaContainer\IZTMediaLibrary\ViewModel\DirInfo.cs:line 65
---------------------------
Could you please help me.
I'm using my own Collection Implementation and bind this to GridView
public
class
BindingTypedList<T> : Collection<T>, INotifyCollectionChanged
{
public
void
AddRange(IList<T> items)
{
foreach
(T item
in
items)
{
this
.Add(item);
}
FireCollectionChanged(items);
}
public
void
FireCollectionChanged(IList<T> items)
{
try
{
if
(CollectionChanged !=
null
)
CollectionChanged(
this
,
new
NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, items.ToList()));
}
catch
(Exception ex)
{
MessageBox.Show(ex.Message +
"\n"
+ ex.StackTrace);
}
}
public
event
NotifyCollectionChangedEventHandler CollectionChanged;
}
---------------------------
Index must be within the bounds of the List.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.Collections.Generic.List`1.Insert(Int32 index, T item)
at Telerik.Windows.Data.KeyedCollection.Insert(Int32 index, Object value) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\KeyedCollection.cs:line 179
at Telerik.Windows.Data.QueryableCollectionView.ProcessSynchronousCollectionChanged(NotifyCollectionChangedEventArgs args) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 1476
at Telerik.Windows.Data.QueryableCollectionView.ProcessCollectionChanged(NotifyCollectionChangedEventArgs args) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 1340
at Telerik.Windows.Data.QueryableCollectionView.OnSourceCollectionChanged(Object sender, NotifyCollectionChangedEventArgs args) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 1817
at Telerik.Windows.Data.QueryableCollectionView.Telerik.Windows.Data.IWeakEventListener<System.Collections.Specialized.NotifyCollectionChangedEventArgs>.ReceiveWeakEvent(Object sender, NotifyCollectionChangedEventArgs args) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\Collections\QueryableCollectionView.cs:line 1797
at Telerik.Windows.Data.WeakEvent.WeakListener`1.Handler(Object sender, TArgs args) in c:\TB\102\WPF_Scrum\Release_WPF\Sources\Development\Core\Data\WeakEvents\WeakEvent.cs:line 33
at FileExplorer.ViewModel.BindingTypedList`1.FireCollectionChanged(IList`1 items) in D:\Y\IZTMediaContainer\IZTMediaLibrary\ViewModel\DirInfo.cs:line 65
---------------------------