c# - Scrolling in a ItemsControl while using a horizontal StackPanel as the ItemsPanel -


i have itemscontrol, i've built items i'm displaying in (views:displaygroupview) in such way expand horizontally show contents , not vertically (only using available height)

i've changed itemspanel of itemscontrol use stackpanel orientation="horizontal"

layout wise it's perfect, no matter can't scroll horizontally can see everything.

this xaml itemscontrol:

    <itemscontrol itemssource="{binding displaygroups}" grid.row="1" margin="120,20,120,20" verticalcontentalignment="stretch">         <itemscontrol.itemspanel>             <itemspaneltemplate >                 <stackpanel orientation="horizontal" scrollviewer.horizontalscrollmode="enabled" scrollviewer.horizontalscrollbarvisibility="visible"/>             </itemspaneltemplate>         </itemscontrol.itemspanel>          <itemscontrol.itemtemplate>             <datatemplate>                 <views:displaygroupview margin="0,0,20,0" datacontext="{binding}" verticalalignment="stretch"></views:displaygroupview>             </datatemplate>         </itemscontrol.itemtemplate>     </itemscontrol> 

this lays out okay, won't scroll. i've tried changing itemscontrols template include scrollviewer, stacks things vertically:

            <itemscontrol.template>                 <controltemplate>                     <scrollviewer x:name="scrollviewer" padding="{templatebinding padding}" verticalcontentalignment="stretch" scrollviewer.horizontalscrollmode="enabled" scrollviewer.verticalscrollmode="disabled">                         <itemspresenter verticalalignment="stretch"/>                     </scrollviewer>                 </controltemplate>             </itemscontrol.template> 

how can horizontal layout while still being able scroll?

if pull out of itemscontrol , embed itself, reason acts workaround like;

<scrollviewer verticalscrollbarvisibilty="disabled" horizontalscrollbarvisibility="auto">   <itemscontrol/> </scrollviewer> 

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -