-
Sep 5th, 2022, 11:40 AM
#1
Thread Starter
Addicted Member
binding to datagrid
Hello, I've this class to manage the final result of a competition:
Code:
Public Class Player
Private _name As String
Public Property Name As String
Get
Return _name
End Get
Set(ByVal value As String)
_name = value
End Set
End Property
Private _matchScore As Integer()
Public Property matchScore As Integer()
Get
Return _matchScore
End Get
Set(ByVal value As Integer())
_matchScore = value
End Set
End Property
Private _points As Integer()
Public Property Points As Integer()
Get
Return _points
End Get
Set(ByVal value As Integer())
_points = value
End Set
End Property
End Class
and this one for handle the competition:
Code:
Public Class Game
Private _Name As String
Public Property Name As String
Get
Return _Name
End Get
Set(ByVal value As String)
_Name = value
End Set
End Property
Private _nMatch As Integer
Public Property nMatch As Integer
Get
Return _nMatch
End Get
Set(ByVal value As Integer)
_nMatch = value
End Set
End Property
Private _nTarget As Integer
Public Property nTarget As Integer
Get
Return _nTarget
End Get
Set(ByVal value As Integer)
_nTarget = value
End Set
End Property
End Class
I declared the competition and add the players with their results:
Code:
Public Property myCompetition As Game
myCompetition = New Game With {.Name = "Test", .nMatch = 2, .nTarget = 55}
GamePlayers.Add(New Player With {.Name = "A", .TotalScore = 5, .matchScore = {2, 3}, .Points = {1, 0, 1, 0, 0, 1, 0, 0, 1, 1}})
GamePlayers.Add(New Player With {.Name = "B", .TotalScore = 9, .matchScore = {4, 5}, .Points = {1, 1, 1, 1, 0, 1, 1, 1, 1, 1}})
GamePlayers.Add(New Player With {.Name = "C", .TotalScore = 9, .matchScore = {5, 4}, .Points = {1, 1, 1, 1, 1, 1, 1, 1, 1, 0}})
Now I would like to show in a datagrid for each match all point (1 for column) and the other property but not the TotalScore.
My problem is how to display Points and matchScore, since I cannot use MappingName in xaml to bind the column since changing the nMatch property .Points's dimension change.
Any advice?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|