windows phone 8 - Hide scrollbar in LongListSelector -


i'm using longlistselector , scrollbar on right adding bit of empty space messing design, want hide it. i've tried following:

scrollbar sb = ((frameworkelement)visualtreehelper.getchild(filelist, 0))                            .findname("verticalscrollbar") scrollbar; sb.width = 0; 

but that's not working wp8, can make width larger though not smaller. has scrollviewer.verticalscrollbarvisibility property changing hidden or disabled doesn't anything.

/edit:

this appears work:

var sb = ((frameworkelement) visualtreehelper.getchild(filelist, 0)) .findname("verticalscrollbar") scrollbar; sb.margin = new thickness(-10, 0, 0, 0); 

but if has cleaner method still hear it.

you can address retemplating whole control.

add resource:

<style x:key="longlistselectorwithnoscrollbarstyle" targettype="phone:longlistselector">     <setter property="background" value="transparent"/>     <setter property="foreground" value="{staticresource phoneforegroundbrush}"/>     <setter property="template">         <setter.value>             <controltemplate targettype="phone:longlistselector">                 <grid background="{templatebinding background}" d:designwidth="480" d:designheight="800">                     <visualstatemanager.visualstategroups>                         <visualstategroup x:name="scrollstates">                             <visualstategroup.transitions>                                 <visualtransition generatedduration="00:00:00.5"/>                             </visualstategroup.transitions>                             <visualstate x:name="scrolling" />                             <visualstate x:name="notscrolling"/>                         </visualstategroup>                     </visualstatemanager.visualstategroups>                     <grid margin="{templatebinding padding}">                         <viewportcontrol x:name="viewportcontrol" horizontalcontentalignment="stretch" verticalalignment="top"/>                     </grid>                 </grid>             </controltemplate>         </setter.value>     </setter> </style> 

use resource

<phone:longlistselector style="{staticresource longlistselectorwithnoscrollbarstyle}">     .... </phone:longlistselector> 

voila. no scrollbar.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -