data binding - Have a databound WPF Listbox generate subclassed ListboxItems -


I would like to do my WPF listboxes, which is database, generates sub-boxed list boxes instead of regular listbox items. In this case, a data template is not enough because I need some custom properties for subclassed listboxime.

Did the list box generate mySubClassedListBoxItem item for bound data?

Thanks, Bart

You must create your sub-section of the list box You can override the method that container, such as

  public class MyListBox: listbox {public MyListBox (// default style & amp; needed; Styles are not inherited from the template since style = searchersource (typef (listbox) style; } Secure Override dependency object GetContainerForItemOverride () {var container = new MyListBoxItem (); Return container; }} Public class MyListBoxItem: ListBoxItem {Public MyListBoxItem () {Style = FindResource (typeof (ListBoxItem)) in style; // To view easily that these custom listboxes are: // textual.SetgroundGround (this, brush .Red); } // ...}  

Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -