c# - Scrollbar ItemsControl fill vertically and then scroll horizontal -


i have itemscontrol items. want items ordered in picture. if there more elements, space, there should horizontal scrollbar. how archive this?

enter image description here relevant code:

 <itemscontrol.template>     <controltemplate targettype="itemscontrol">       <scrollviewer panningmode="both" >         <itemspresenter />        </scrollviewer>       </controltemplate>   </itemscontrol.template>   <itemscontrol.itemspanel>     <itemspaneltemplate>       <wrappanel />     </itemspaneltemplate>   </itemscontrol.itemspanel> 

edit: i'm sorry reported suggested solutions did not work, turns out height of items changing dynamically on runtime, resulting in space 1 item vertically.

would work ?

<itemscontrol.template>     <controltemplate targettype="itemscontrol">       <scrollviewer horizontalscrollbarvisibility="auto"            verticalscrollbarvisibility="disabled" > 

and if doesnt work, try this

<itemscontrol.itemspanel>     <itemspaneltemplate>       <wrappanel height="{binding relativesource={relativesource            mode=findancestor, ancestortype={x:type scrollviewer}},            path=actualheight}" /> 

edit

don't forget make wrappanel orientation="vertical"


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -