I'm going to expand my comment...
ItemSource is meant to be bound to an object that supports property change notification. What you should do is implement INotifyPropertyChanged on your class (I'm assuming the code-behind for that page) then add a property for each ItemSource:
public ObservableCollection<object> ParentItemSource
{
get
{
return _parentItemSource;
}
set
{
if(_parentItemSource != value)
{
_parentItemSource = value;
RaisePropertyChanged("ParentItemSource");
}
}
}</object>
Of course your RaisePropertyChanged method will be whatever you name it and it simply raises the PropertyChanged event specified by INotifyPropertyChanged.
In the xaml, you now declaritively bind ItemSource:
<listbox name="CurrentListbox">
VerticalAlignment ="Stretch"
Margin=" 8"
removed="Transparent"
Height="Auto"
BorderThickness="0"
HorizontalContentAlignment="Center"
FlowDirection="LeftToRight"
HorizontalAlignment="Center"
ItemSource="{Binding ParentItemSource}"></listbox>
The listbox will automagically hook to the backing collection. Anything you do to the collection will now be reflected (in a thread-safe manner) on the UI. From here, clearing the collection becomes:
ParentItemSource = null;
Re-populating it becomes a matter of creating a temp collection via the for..each loop then assigning that collection to the public property:
Dim P = Load_Parent_People(CurrentID)
Dim tempP = new ObservableCollection<object>()
Try
If P IsNot Nothing Then
For I = 0 To P.Count - 1
tempP.Add(P(I))
Next
End If
ParentItemSource = tempP
Catch</object>
(Sorry for the jumping between languages :-) )
The important thing is that the binding mechanism separates the changes to the underlying collection from the UI. You HAVE to do that because UI updates are async due to the eventing mechanism. Bindings are there to take that problem away and provide an in-code, strongly-typed abstraction of the data.
Hope that helps!