Change ScrollBar Style of ListBox RRS feed

  • Question

  • Hi All,

    I need t change the scrollBar style of some LISTBOX.

    Any Suggestion Would be of great help.



    • Changed type Xavier Xie-MSFT Sunday, August 28, 2016 7:28 AM it's a question
    Tuesday, August 9, 2016 9:49 AM

All replies

  • You could put an implicit custom ScrollBar style in the Resources dictionary of the ListBox, e.g.:

    <ListBox x:Name="lb" Height="50">
                    <Style TargetType="ScrollBar">
                        <Setter Property="Template">
                                <ControlTemplate TargetType="ScrollBar">
                                    <TextBlock>I am a ScrollBar!</TextBlock>

    You could copy the default style/template of the ScrollBar by adding a <ScrollBar /> element to your XAML markup, switch to design mode and choose Edit Template->Edit a Copy in Visual Studio 2012 or later. You can then edit the style/template as per your requirements before you add it to the Resources section of the ListBox as per above. Don't forget to remove the x:Key attribute from the Style in order to make it an implicit style. Please refer to the following links for more information about implicit styles:

    Hope that helps.

    Please change the type of this thread from discussion to question and please also remember to close your threads by marking helpful posts as answer and then start a new thread if you have a new question. Please don't ask several questions in the same thread.

    Tuesday, August 9, 2016 4:51 PM