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

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -