As a newbie I am struggling with the data binding syntax. In the code below I have used a class to create a simple data structure. (I need to be able to fill this from an array which I can do.) For this example I have filled it in directly.
However, despite exhaustive searching in the web I cannot find a Visual Basic example showing me how to bind this data source to a Datagrid. I have included in the code the xaml for a basic data grid. Can anynbe help me with the xaml to bind the fields to
textboxes?
Class MainWindow
Public test As String
' Public mage() As Integer = {24, 35, 46, 57}
Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
Dim P1 As New myPerson(111, "Bob", 23)
Dim P2 As New myPerson(222, "Fred", 34)
Dim P3 As New myPerson(333, "Bill", 17)
Dim P4 As New myPerson(121, "Alf", 44)
Dim st As New SortedList
st.Add(P1.name, P1)
st.Add(P2.name, P2)
st.Add(P3.name, P3)
st.Add(P4.name, P4)
Dim P As myPerson
Dim i As Integer
For i = 0 To st.Count - 1
P = CType(st.GetByIndex(i), myPerson)
Console.WriteLine("The age of " & P.name & " is " & P.age)
Next
End Sub
End Class
Public Class myPerson
Public id As Integer
Public name As String
Public age As In
View Complete Post