in wpf document have like:
<listbox x:name="lbnames" height="400" width="400"> <listbox.itemtemplate> <datatemplate> <stackpanel> <textblock text="{binding element[icon].value}" /> <textblock text="{binding element[name].value}" /> </stackpanel> </datatemplate> </listbox.itemtemplate> </listbox>
but want list horizontal , if there not enough space, want next item in new line. @ end should grid.
optional: if there not enough space vertically, want scrollbar.
you need change items panel wrappanel
<listbox x:name="lbnames" height="400" width="400" scrollviewer.horizontalscrollbarvisibility="disabled"> <listbox.itemspanel> <itemspaneltemplate> <wrappanel/> </itemspaneltemplate> </listbox.itemspanel> <listbox.itemtemplate> <datatemplate> <stackpanel> <textblock text="{binding element[icon].value}" /> <textblock text="{binding element[name].value}" /> </stackpanel> </datatemplate> </listbox.itemtemplate> </listbox>
Comments
Post a Comment