I am trying to build a small application with a combobox and the issue is that the items are not getting updated in it properly, sometimes 2 items sometime 4 items are only getting visible however the items count is getting updated properly. Following is the xaml code:
<ComboBox Name="NumbersCombo" Width="118">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Title}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
Following is the code for itemssource on page load, where con.Numbers is dictionary of string and Numbers class, hence Values are sent for attachment:
NumbersCombo.ItemsSource = con.Numbers.Values
Following is the code for adding new items to combobox:
Dim temp As New BSPLib.ContactLib.ContactCon(con.prime.Conid, False)
con.Numbers.Add(temp.ConRowID, temp)
NumbersCombo.ItemsSource = con.Numbers.Values
TestLabel1.Content = NumbersCombo.Items.Count
Following is the code for the class:
Public Class ContactCon
Property ConId As String
Property ConRowID As String
Property Title As String
Property Mob1 As String
Property Mob2 As String
Property Land1 As String
Property Land2 As String
Property Email1 As String
Property Email2 As String
Property Fax1 As String
Property Fax2 As String
Property Primary As Boolean
Public Sub New()
End Sub
Public Sub New(ByVal contactID As String, ByVal primarynumbers As Boolean)
ConId = contactID
ConRowID = contactID & "-" & Now.ToString
If primarynumbers = True Then
Title = "Primary Details"
Else
Title = "Additional Contact Numbers"
End If
Mob1 = ""
Mob2 = ""
Land1 = ""
Land2 = ""
Email1 = ""
Email2 = ""
Fax1 = ""
Fax2 = ""
Primary = primarynumbers
End Sub
End Class
Public Class Contact
Public prime As ContactPrime
Public addrs As Dictionary(Of String, ContactAddress)
Public Numbers As Dictionary(Of String, ContactCon)
Public Sub New()
Numbers = New Dictionary(Of String, ContactCon)
'assigning initial ids and values
Dim t As New ContactCon(prime.Conid, vbYes)
Numbers.Add(t.ConRowID, t) 'Primary Contact Number
End Sub
In simple, the gui of combo box is not showing the items but the items count is correct, could you please tell where I have gone wrong. Thank you.