wpf - How to Style AvalonEdit ScrollBars -
i'm trying change thumb color of scrollbars in avalonedit. i've tried number of approaches:
style scrollviewer - lots of examples can't of them compile , when don't work.
use findtemplate , change thumb colors @ runtime. works in many not cases.
all want change thumb color. come'on wpf, throw me bone.
please put me out of misery , show me how.
follow up:
i able of wanted changing default thumb style:
<usercontrol.resources> <style x:key="{x:type thumb}" targettype="{x:type thumb}"> <setter property="opacity" value="0.1" /> </style> </usercontrol.resources>
however, if try add control template style, has no effect. every time think understand wpf styling, happens convince me know nothing.
based on page: msdn
you can this:
<style targettype="{x:type thumb}" x:key="scrollbarthumb"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type thumb}"> <border cornerradius="2" background="black" borderbrush="red" borderthickness="1" /> </controltemplate> </setter.value> </setter> </style> <style targettype="scrollbar"> <setter property="template"> <setter.value> <controltemplate targettype="{x:type scrollbar}"> <grid> <grid.rowdefinitions> <rowdefinition maxheight="18" /> <rowdefinition height="0.00001*" /> <rowdefinition maxheight="18" /> </grid.rowdefinitions> <border grid.rowspan="3" /> <repeatbutton grid.row="0" command="scrollbar.lineupcommand" content="m 0 4 l 8 4 l 4 0 z" /> <track x:name="part_track" grid.row="1" isdirectionreversed="true"> <track.thumb> <thumb style="{staticresource scrollbarthumb}" margin="1,0,1,0"/> </track.thumb> </track> <repeatbutton grid.row="3" command="scrollbar.linedowncommand" content="m 0 0 l 4 4 l 8 0 z" /> </grid> </controltemplate> </setter.value> </setter> </style>
Comments
Post a Comment