我有一个绑定到组合框的数据列表,因此组合框中的每个项目都有三组不同的数据。 这是我的数据:
Private Class PhotoType
Public Property FrameDimension() As Integer()
Public Property InnerFrameMargin() As Integer() '{top, bottom, left, right}
Public Property InnerFramePosition() As Integer() '{xpos, ypos}
Public Property PhotoData() As List(Of Integer())
End Class
Public Function PhotoList()
Dim listPhoto As New List(Of PhotoType) From {
'------------ Item 1 --------------
New PhotoType With {
.FrameDimension = {60, 90},
.InnerFrameMargin = {10, 30, 10, 10},
.InnerFramePosition = {5, -5}},
'------------ Item 2 --------------
New PhotoType With {
.FrameDimension = {60, 90},
.InnerFrameMargin = {5, 5, 5, 5},
.InnerFramePosition = {5, -5}}
}
PhotoList = listPhoto
End Function
在我后面的代码中,这是我的代码:
Private Sub DockerPolaroid_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
With cb_layout
.SelectedValuePath = "PhotoData"
.ItemsSource = ClsData.PhotoList
End With
End Sub
因此,我需要将三个数组合并为一个数据,以便可以将它们放在WPF形式后面的代码中的SelectedValuePath中。我创建了一个名为photodata
的列表变量来保存所有这些数据,但是我不确定什么是正确的方法。我是否应该将数据存储在一个数组中才能工作?