This is equivalent to the DoEvents of winforms.
And here is the modified code.
Private Sub Window2_ContentRendered(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ContentRendered
Dim strItem As String
Dim i As Integer
i = 1
While i < 10000
strItem = "Document # " + i.ToString() + " added"
Dim listBoxItem As New ListBoxItem()
listBoxItem.Content = strItem
ListBox1.Items.Add(listBoxItem);
App.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Loaded, DirectCast(Function() Do End Function, Action))
i += 1
End While
End Sub
Note: There could be a syntax error on the line in brown.