wpf - Can you please explain why the Binding not working for DisplayMemberPath of ItemsControl? -


can 1 please explain why binding not working displaymemberpath of itemscontrol?

and checked reflector displaymemberpath of itemscontrol dependency property,and bindable attribute set true only.

xaml:

  <combobox x:name="display" displaymemberpath="{binding newaddress.telephone}" itemssource="{binding persons}"/> 

person class:

public class person {     public person()     {         persons = new observablecollection<newaddress>();         persons.add(new newaddress() { telephone = "myno" });         persons.add(new newaddress() { telephone = "myno1" });         persons.add(new newaddress() { telephone = "myno2" });         persons.add(new newaddress() { telephone = "myno3" });     }      private observablecollection<newaddress> persons;      public observablecollection<newaddress> persons     {         { return persons; }         set { persons = value; }     }  } 

address class:

 public class newaddress {     public string  telephone { get; set; } } 

displaymemberpath actual name of property, not binding property. change xaml code following:

<combobox x:name="display" displaymemberpath="telephone" itemssource="{binding persons}"/> 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -