c# - GridView with GridViewItem Cutoff -


i have wp8.1 page created xaml: `

<grid>     <grid.columndefinitions>         <columndefinition width="*"/>         <columndefinition width="18*"/>         <columndefinition width="*"/>     </grid.columndefinitions>     <grid.rowdefinitions>         <rowdefinition height="*"/>         <rowdefinition height="*"/>         <rowdefinition height="9*"/>         <rowdefinition height="*"/>     </grid.rowdefinitions>      <gridview x:name="gridcategory" grid.row="0" grid.column="0" grid.columnspan="3"  scrollviewer.horizontalscrollmode="enabled" scrollviewer.verticalscrollmode="disabled" scrollviewer.horizontalscrollbarvisibility="visible" sizechanged="gridcategory_sizechanged">         <gridview.itemspanel>             <itemspaneltemplate>                 <virtualizingstackpanel orientation="horizontal"/>             </itemspaneltemplate>         </gridview.itemspanel>         <gridview.itemtemplate>             <datatemplate>                 <image source="{binding imagepath}" stretch="uniformtofill" verticalalignment="stretch"/>             </datatemplate>         </gridview.itemtemplate>     </gridview> </grid> 

`

the datasource of <image> list of objects property imagepath path images in folder. data populated gridview inside method onnavigatedto.

my problem shows when running inside emulator.

enter image description here

but want:

enter image description here

i can't increase height of rowdefinition or set fixed size <image>.

is there way make images inside gridview scale smaller height fit height of gridviewitem , not cutoff ?

i looked @ post: gridviewitem height greater gridview height, doesn't help.

i don't think there's way in 8.1. think you'll have math compute height want image elements , assign height via binding imagesource. you'll have set height value in gridcategory_sizechanged minus bit. might have change itemcontainerstyle remove space.


Comments