wpf - Nested ItemsControl Orientation -


i have nested itemscontrol. data structure observablecollection of campaigns consist of campaign class , observablecollection of data counts (total, assigned, unassigned, closed). need following:

campaign.name      total     unassigned     assigned     closed campaign.name      total     unassigned     assigned     closed 

i able first part of this, reason not honor orientation second itemscontrol. missing? xaml is:

<itemscontrol x:name="iccampaignchicklets" itemssource="{binding campchicks}" grid.row="1">         <itemscontrol.itemspanel>             <itemspaneltemplate>                 <stackpanel orientation="vertical" />             </itemspaneltemplate>         </itemscontrol.itemspanel>         <itemscontrol.itemtemplate>             <datatemplate>                 <grid x:name="gridcontent">                     <grid.rowdefinitions>                         <rowdefinition height="20" />                         <rowdefinition height="*" />                     </grid.rowdefinitions>                     <textblock x:name="campaignheader" height="20" text="{binding path=campaign.name}" grid.row="1"  verticalalignment="top" textwrapping="wrap" horizontalalignment="left" />                     <stackpanel grid.row="1" orientation="horizontal" margin="10">                         <itemscontrol x:name="icchicklets" itemssource="{binding path=data}">                             <itemscontrol.itemtemplate>                                 <datatemplate>                                     <border width="150" height="140" background="{binding background}" cursor="hand"                                     mouseleftbuttondown="chicklet_mouseleftbuttondown"                                     >                                         <grid x:name="gridcontent" margin="8,4">                                             <textblock text="{binding caption}" foreground="white" fontsize="17" />                                             <textblock text="{binding countcaption, mode=oneway}" foreground="white" fontsize="45" verticalalignment="center" horizontalalignment="right" margin="7" />                                             <textblock text="Ú" foreground="#99ffffff" fontsize="30" verticalalignment="bottom" horizontalalignment="right" margin="3,5" fontfamily="wingdings 3" />                                         </grid>                                     </border>                                 </datatemplate>                              </itemscontrol.itemtemplate>                         </itemscontrol>                     </stackpanel>                 </grid>             </datatemplate>         </itemscontrol.itemtemplate>     </itemscontrol> 

if want change orientation of contents of itemscontrol, set itemspanel property so:

<itemscontrol     ...attributes...     >     <itemscontrol.itemspanel>         <itemspaneltemplate>             <stackpanel orientation="horizontal" />         </itemspaneltemplate>     </itemscontrol.itemspanel> </itemscontrol> 

wrapping in horizontally-oriented parent stackpanel merely arrange , siblings horizontally, in particular case has no siblings.


Comments