wpf - ScrollViewer styled with images doesn't scroll on full track -


in wpf application, have styled scrollbar using images background , thumb. scrollbar scrolling along whole height of scrollbar. inside scrollviewer, thumb doesn't scroll along whole track. scrolls in middle of track doesn't close ends of scrollbars. please see attached image.

below scrollbar style:

    <imagebrush x:key="scrollbar.static.background" imagesource="/wpfapplication1;component/resources/zeepad v1.65b dev vertical slide.png" stretch="fill" /> <imagebrush x:key="scrollbar.static.horizontal.background" imagesource="/wpfapplication1;component/resources/zeepad v1.65b dev vertical slide - horizontal.png" stretch="fill" /> <imagebrush x:key="scrollbar.mouseover.thumb" imagesource="/wpfapplication1;component/resources/zeepad v1.65b dev slider knob.png" stretch="uniform" /> <imagebrush x:key="scrollbar.pressed.thumb" imagesource="/wpfapplication1;component/resources/zeepad v1.65b dev slider knob.png" stretch="uniform" /> <imagebrush x:key="scrollbar.static.thumb" imagesource="/wpfapplication1;component/resources/zeepad v1.65b dev slider knob.png" stretch="uniform" /> <solidcolorbrush x:key="scrollbar.static.border" color="#f0f0f0"/> <style x:key="scrollbarthumbvertical" targettype="{x:type thumb}">     <setter property="overridesdefaultstyle" value="true"/>     <setter property="istabstop" value="false"/>     <setter property="template">         <setter.value>             <controltemplate targettype="{x:type thumb}">                 <rectangle x:name="rectangle" fill="{staticresource scrollbar.static.thumb}" height="{templatebinding height}" snapstodevicepixels="true" width="{templatebinding width}"/>                 <controltemplate.triggers>                     <trigger property="ismouseover" value="true">                         <setter property="fill" targetname="rectangle" value="{staticresource scrollbar.mouseover.thumb}"/>                     </trigger>                     <trigger property="isdragging" value="true">                         <setter property="fill" targetname="rectangle" value="{staticresource scrollbar.pressed.thumb}"/>                     </trigger>                 </controltemplate.triggers>             </controltemplate>         </setter.value>     </setter> </style> <style x:key="scrollbarthumbhorizontal" targettype="{x:type thumb}">     <setter property="overridesdefaultstyle" value="true"/>     <setter property="istabstop" value="false"/>     <setter property="template">         <setter.value>             <controltemplate targettype="{x:type thumb}">                 <rectangle x:name="rectangle" fill="{staticresource scrollbar.static.thumb}" height="{templatebinding height}" snapstodevicepixels="true" width="{templatebinding width}"/>                 <controltemplate.triggers>                     <trigger property="ismouseover" value="true">                         <setter property="fill" targetname="rectangle" value="{staticresource scrollbar.mouseover.thumb}"/>                     </trigger>                     <trigger property="isdragging" value="true">                         <setter property="fill" targetname="rectangle" value="{staticresource scrollbar.pressed.thumb}"/>                     </trigger>                 </controltemplate.triggers>             </controltemplate>         </setter.value>     </setter> </style> <style targettype="{x:type scrollbar}">     <setter property="stylus.ispressandholdenabled" value="false"/>     <setter property="stylus.isflicksenabled" value="false"/>     <setter property="background" value="{staticresource scrollbar.static.background}"/>     <setter property="borderbrush" value="{staticresource scrollbar.static.border}"/>     <setter property="foreground" value="{dynamicresource {x:static systemcolors.controltextbrushkey}}"/>     <setter property="borderthickness" value="1,0"/>     <setter property="width" value="{dynamicresource {x:static systemparameters.verticalscrollbarwidthkey}}"/>     <setter property="minwidth" value="{dynamicresource {x:static systemparameters.verticalscrollbarwidthkey}}"/>     <setter property="template">         <setter.value>             <controltemplate targettype="{x:type scrollbar}">                 <grid x:name="bg" snapstodevicepixels="true">                     <border borderbrush="{templatebinding borderbrush}" borderthickness="{templatebinding borderthickness}" background="{templatebinding background}" />                     <track x:name="part_track" isdirectionreversed="true" isenabled="{templatebinding ismouseover}" >                         <track.thumb>                             <thumb style="{staticresource scrollbarthumbvertical}"/>                         </track.thumb>                     </track>                 </grid>                 <controltemplate.triggers>                     <trigger property="isenabled" value="false"/>                 </controltemplate.triggers>             </controltemplate>         </setter.value>     </setter>     <style.triggers>         <trigger property="orientation" value="horizontal">             <setter property="width" value="auto"/>             <setter property="minwidth" value="0"/>             <setter property="height" value="{dynamicresource {x:static systemparameters.horizontalscrollbarheightkey}}"/>             <setter property="minheight" value="{dynamicresource {x:static systemparameters.horizontalscrollbarheightkey}}"/>             <setter property="borderthickness" value="0,1"/>             <setter property="template">                 <setter.value>                     <controltemplate targettype="{x:type scrollbar}">                         <grid x:name="bg" snapstodevicepixels="true">                             <border borderbrush="{templatebinding borderbrush}" borderthickness="{templatebinding borderthickness}" background="{staticresource scrollbar.static.horizontal.background}" />                             <track x:name="part_track" isenabled="{templatebinding ismouseover}">                                 <track.thumb>                                     <thumb style="{staticresource scrollbarthumbhorizontal}"/>                                 </track.thumb>                             </track>                         </grid>                         <controltemplate.triggers>                             <trigger property="isenabled" value="false"/>                         </controltemplate.triggers>                     </controltemplate>                 </setter.value>             </setter>         </trigger>     </style.triggers> </style> 

the scrollview style given below:

    <style targettype="scrollviewer">     <setter property="template">         <setter.value>             <controltemplate targettype="{x:type scrollviewer}">                 <grid x:name="grid" background="{templatebinding background}">                     <grid.columndefinitions>                         <columndefinition width="*"/>                         <columndefinition width="auto"/>                     </grid.columndefinitions>                     <grid.rowdefinitions>                         <rowdefinition height="*"/>                         <rowdefinition height="auto"/>                     </grid.rowdefinitions>                     <scrollcontentpresenter x:name="part_scrollcontentpresenter" cancontentscroll="{templatebinding cancontentscroll}" canhorizontallyscroll="false" canverticallyscroll="false" contenttemplate="{templatebinding contenttemplate}" content="{templatebinding content}" grid.column="0" margin="{templatebinding padding}" grid.row="0"/>                     <scrollbar x:name="part_verticalscrollbar" automationproperties.automationid="verticalscrollbar" cursor="arrow" grid.column="1" maximum="{templatebinding scrollableheight}" minimum="0" grid.row="0" visibility="{templatebinding computedverticalscrollbarvisibility}" value="{binding verticaloffset, mode=oneway, relativesource={relativesource templatedparent}}" viewportsize="{templatebinding viewportheight}" />                     <scrollbar x:name="part_horizontalscrollbar" automationproperties.automationid="horizontalscrollbar" cursor="arrow" grid.column="0" maximum="{templatebinding scrollablewidth}" minimum="0" orientation="horizontal" grid.row="1" visibility="{templatebinding computedhorizontalscrollbarvisibility}" value="{binding horizontaloffset, mode=oneway, relativesource={relativesource templatedparent}}" viewportsize="{templatebinding viewportwidth}" />                 </grid>             </controltemplate>         </setter.value>     </setter> </style> 

image attached

any idea why? thanks.


Comments

Popular posts from this blog

curl - PHP fsockopen help required -

HTTP/1.0 407 Proxy Authentication Required PHP -

c# - Resource not found error -