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?
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
Post a Comment