Hello,
I try to delete / clear the Items of a Listbox with
But i get an NullReferenceException, since there are some Elements in the Listbox
I bind a ObservableCollection to the Itemsource Property of the LIstbox:
so - as i said, if there are no items in the Listbox shown up (ListBox.Items.Count = 0) i can do the Clear of the ObservableCollection.
But if there are any Items in the Listbox (just visual, neither in ListBox.Items or neither in my ObservableCollection) i get the NullReferenceException, on the Line of the ObservableCollection.CLear()
Whats wrong with the Listbox? what am i missing or doing wrong?
thanks for any advice
regards
Mike
I try to delete / clear the Items of a Listbox with
Me.datarowExtList.Clear()But i get an NullReferenceException, since there are some Elements in the Listbox
I bind a ObservableCollection to the Itemsource Property of the LIstbox:
ItemsSource="{Binding datarowExtList}" SelectionMode="Single" DisplayMemberPath="DocDescription"Private _datarowExtList As ObservableCollection(Of DataRowExt) = New ObservableCollection(Of DataRowExt) Public Property datarowExtList() As ObservableCollection(Of DataRowExt) Get Return _datarowExtList End Get Set(ByVal value As ObservableCollection(Of DataRowExt)) _datarowExtList = value NotifyPropertyChanged("datarowExtList") End Set End Propertyso - as i said, if there are no items in the Listbox shown up (ListBox.Items.Count = 0) i can do the Clear of the ObservableCollection.
But if there are any Items in the Listbox (just visual, neither in ListBox.Items or neither in my ObservableCollection) i get the NullReferenceException, on the Line of the ObservableCollection.CLear()
Whats wrong with the Listbox? what am i missing or doing wrong?
thanks for any advice
regards
Mike