Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dim lst As New List(Of Property_Deatils)
Dim a1 As New Property_Deatils("ABCD", "xyz")
Dim a2 As New Property_Deatils("xyz", "abcd")
lst.Add(a1)
lst.Add(a2)
Me.ComboBox1.ItemsSource = lst

----------------------------------------
Public Class Property_Deatils
Public property_name As String
Public Property_id As String
Sub New(ByVal property_name As String, ByVal Property_id As String)
Me.property_name = property_name
Me.Property_id = Property_id
End Sub
End Class

-------------------------------------------
Posted

Do you set the DisplayMember of the ComboBox ?
 
Share this answer
 
Tried adding diaplaymember but no luck ,please advise
 
Share this answer
 
(finally i got the answer after breaking my head for one day

You need to add property for each varibales in the class property_details as get and set , then it will update in Xaml file during run time similar to below, refer firstname in the XAML file rather than fname ,
class My_class

Public fname As String
Public lname As String

Public Property firstname As String

Get
Return fname
End Get
Set(ByVal value As String)
fname = value
End Set
End Property

Public Property lastname As String

Get
Return lname
End Get
Set(ByVal value As String)
lname = value
End Set
End Property


End Class 'MyClass
 
Share this answer
 
Hi Monoj,

This is right. You can't assign a variable for this. You must have to implement it as a Property to the class & then you can do this.

If you want to bind it in the XAML & not from the code behind, you have to create DependencyProperty instead of normal Property.

Let me know, if you need more info on DependencyProperty & data binding.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900