wpf - Why my stackpanel items always aligning to vertical if even i mentioned horizantalmode in silverlight? -
i wrote below code in page:
<stackpanel horizontalalignment="left" height="166" margin="10,602,0,0" verticalalignment="top" width="1346" x:name="thumbnailviewer"> <scrollviewer x:name="thumbnailviewerscroller" padding="0" borderthickness="0" verticalscrollbarvisibility="hidden" horizontalscrollbarvisibility="hidden"> <stackpanel orientation="horizontal" > <itemscontrol x:name="userlist"> <itemscontrol.itemtemplate> <datatemplate> <!--<stackpanel orientation="horizontal">--> <image source="{binding imageurl}" tag="{binding path=id}" width="164" height="150" margin="4" stretch="fill"></image> <!--</stackpanel>--> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </stackpanel> </scrollviewer> </stackpanel>
inside of scrollviewer mentionsed stackpanel , aligning items horizontal.but getting items alignment vertical while running of code.please tell me how align items horizontal?what wrong in code why items aliging vertical mentionsed orientation="horizontal in stackpanel.
edit:
<scrollviewer x:name="thumbnailviewerscroller" padding="0" borderthickness="0" verticalscrollbarvisibility="hidden" horizontalscrollbarvisibility="hidden"> <!--<stackpanel orientation="horizontal" >--> <itemscontrol x:name="userlist"> <itemscontrol.itemspanel> <itemspaneltemplate> <!--<datatemplate>--> <stackpanel orientation="horizontal"> <image source="{binding imageurl}" tag="{binding path=id}" width="164" height="150" margin="4" stretch="fill"></image> </stackpanel> <!--</datatemplate>--> </itemspaneltemplate> </itemscontrol.itemspanel> </itemscontrol> </scrollviewer> </stackpanel>
use itemspanel
of itemscontrol
instead.
<scrollviewer> <itemscontrol ...> <itemscontrol.itemspanel> <itemspaneltemplate> <stackpanel orientation="horizontal" /> </itemspaneltemplate> </itemscontrol.itemspanel> <itemscontrol.itemtemplate> <datatemplate> <image source="{binding imageurl}" tag="{binding path=id}" width="164" height="150" margin="4" stretch="fill"></image> </datatemplate> </itemscontrol.itemtemplate> </itemscontrol> </scrollviewer>
Comments
Post a Comment