c# - Populate two column grid with databinding? -
how populate 2 column grid objects observable collection?
i've tried achieve effect using tookits wrap panel items stack.
<toolkit:wrappanel margin="5,0,0,0" width="400"> <itemscontrol itemssource="{binding trips}"> <itemscontrol.itemtemplate> <datatemplate> <stackpanel height="236" width="182"> <button style="{staticresource vasttrafikbuttontrip}"> <stackpanel width="152" height="140"> <textblock text="{binding fromname}" /> <textblock fontfamily="segoe wp semibold" text="till" /> <textblock text="{binding toname}" /> </stackpanel> </button> <textblock horizontalalignment="left" width="160" fontsize="16" fontweight="extrablack" text="{binding traveltimetext}" /> <textblock horizontalalignment="left" width="160" margin="0,-6,0,0" fontsize="16" text="{binding transfercounttext}" /> </stackpanel> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </toolkit:wrappanel>
the child wrappanel
itemscontrol
stacking done internal itemspanel
in itemscontrol
which, default, stackpanel
vertical orientation. "two columns", try move wrappanel
itemscontrol.itemspanel
instead this
<itemscontrol itemssource="{binding trips}"> <itemscontrol.itemspanel> <itemspaneltemplate> <toolkit:wrappanel margin="5,0,0,0" width="400"/> </itemspaneltemplate> </itemscontrol.itemspanel> <itemscontrol.itemtemplate> <datatemplate> <stackpanel height="236" width="182"> <button style="{staticresource vasttrafikbuttontrip}"> <stackpanel width="152" height="140"> <textblock text="{binding fromname}" /> <textblock fontfamily="segoe wp semibold" text="till" /> <textblock text="{binding toname}" /> </stackpanel> </button> <textblock horizontalalignment="left" width="160" fontsize="16" fontweight="extrablack" text="{binding traveltimetext}" /> <textblock horizontalalignment="left" width="160" margin="0,-6,0,0" fontsize="16" text="{binding transfercounttext}" /> </stackpanel> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol>
Comments
Post a Comment