Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
i want to change the style of listbox's scrollbar.
how do i modify listbox's scrollbar to white color and transparency background?
if possible provide some example.
 
Thanks,
Posted 27-Dec-12 14:53pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

i found solution myself
 
<style x:key="ScrollThumbs" targettype="{x:Type Thumb}" xmlns:x="#unknown">  
            <setter property="Stylus.IsFlicksEnabled" value="false"></setter>
            <setter property="Foreground" value="#8C8C8C"></setter>
            <setter property="Background" value="Transparent"></setter>
            <setter property="Width" value="8"></setter>
            <setter property="Template">
                <setter.value>
                    <controltemplate targettype="{x:Type ScrollBar}">
                        <grid x:name="GridRoot" width="15" background="{TemplateBinding Background}">
                            <grid.rowdefinitions>
                                <rowdefinition height="0.00001*"></rowdefinition>
                            </grid.rowdefinitions>
 
                            <track x:name="PART_Track" grid.row="0" isdirectionreversed="true" focusable="false">
                                <track.thumb>
                                    <thumb x:name="Thumb" background="{TemplateBinding Foreground}" style="{DynamicResource ScrollThumbs}"></thumb>
                                </track.thumb>
                                <track.increaserepeatbutton>
                                    <repeatbutton x:name="PageUp" command="ScrollBar.PageDownCommand" opacity="0" focusable="false"></repeatbutton>
                                </track.increaserepeatbutton>
                                <track.decreaserepeatbutton>
                                    <repeatbutton x:name="PageDown" command="ScrollBar.PageUpCommand" opacity="0" focusable="false"></repeatbutton>
                                </track.decreaserepeatbutton>
                            </track>
                        </grid>
 
                        <controltemplate.triggers>
                            <trigger sourcename="Thumb" property="IsMouseOver" value="true">
                                <setter value="{DynamicResource ButtonSelectBrush}" targetname="Thumb" property="Background"></setter>
                            </trigger>
                            <trigger sourcename="Thumb" property="IsDragging" value="true">
                                <setter value="{DynamicResource DarkBrush}" targetname="Thumb" property="Background"></setter>
                            </trigger>
 
                            <trigger property="IsEnabled" value="false">
                                <setter targetname="Thumb" property="Visibility" value="Collapsed"></setter>
                            </trigger>
                            <trigger property="Orientation" value="Horizontal">
                                <setter targetname="GridRoot" property="LayoutTransform">
                                    <setter.value>
                                        <rotatetransform angle="-90"></rotatetransform>
                                    </setter.value>
                                </setter>
                                <setter targetname="PART_Track" property="LayoutTransform">
                                    <setter.value>
                                        <rotatetransform angle="-90"></rotatetransform>
                                    </setter.value>
                                </setter>
                                <setter property="Width" value="Auto"></setter>
                                <setter property="Height" value="8"></setter>
                                <setter targetname="Thumb" property="Tag" value="Horizontal"></setter>
                                <setter targetname="PageDown" property="Command" value="ScrollBar.PageLeftCommand"></setter>
                                <setter targetname="PageUp" property="Command" value="ScrollBar.PageRightCommand"></setter>
                            </trigger>
                        </controltemplate.triggers>
                    </controltemplate>
                </setter.value>
            </setter>
        </style>
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 458
1 OriginalGriff 384
2 George Jonsson 233
3 Animesh Datta 130
4 Shemeemsha RA 128
0 OriginalGriff 6,179
1 Sergey Alexandrovich Kryukov 5,616
2 CPallini 4,770
3 George Jonsson 3,400
4 Gihan Liyanage 2,522


Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 27 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100