WPF ComboBox DataBinding vb.net -
I am attempting to replicate Cumblox using the database. Below are the snippets of my code
XAML:
& lt; Combo Box Name = "CmbClientName" items Source = "{Binding Path = blClientList}" DisplayMemberPath = "name" SelectedValuePath = "name" SelectedValue = "{Binding Path = blClientList}" / & gt; View <(b) as a vague compilation (of string) = New Observable Collection (as dim objClientRepository string) PET_ClientRepository = new PE T_ClientRepository objClientRepository.GetAll (in PET_Client as each objClient) blClientList.Add (objClient.Name) Next Me.cmbClientName.ItemsSource = blClientList end sub < / pre> Class1.vb:
Return the name of public property as a string _nam finally set _Name = (value as string) value And set and pr Pertie I want to see the client's name in my combo box. The above code does not return anything and the combobox is empty. I know that the problem is binding but it can not understand what I am doing.
Change it:
Me.cmbClientName.ItemsSource = blClientList < / Code> From:
Me.DataConext = blClientList and right as XAML:
& lt; Combo box name = "cmbClientName" item source = "{binding}" DisplayMemberPath = "." SelectedValuePath = / & gt; ".";
Comments
Post a Comment