Text 1Text 2
//File:Window.xaml.vb
Imports System.Windows
Imports System.Windows.Controls
Imports System.Windows.Documents
Namespace WpfApplication1
Public Partial Class IndexOfSample
Private Sub FindIndex(sender As Object, e As RoutedEventArgs)
Dim newText As New TextBlock()
MainDisplayPanel.Children.Add(newText)
newText.Text = "New element #"
DockPanel.SetDock(newText, Dock.Top)
TxtDisplay.Text = MainDisplayPanel.Children.IndexOf(newText) + ""
End Sub
End Class
End Namespace