Click here to Skip to main content
15,902,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I am trying to change the scrollbar in the listbox. I try'd many way to Change that. If the scroll is changed means the Listbox items are not showing. So i put grid to show both. But that also not working. Any one knows please help me in this.

<Style x:Key="mylists" TargetType="{x:Type ListBox}">
       <Setter Property="SnapsToDevicePixels" Value="true"/>
       <Setter Property="OverridesDefaultStyle" Value="true"/>
       <Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
       <Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
       <Setter Property="ScrollViewer.CanContentScroll" Value="true"/>
       <Setter Property="MinWidth" Value="120"/>
       <Setter Property="MinHeight" Value="95"/>
           <Setter Property="Template">
               <ControlTemplate TargetType="{x:Type ListBox}">
                       <Border x:Name="bd" Background="White">
                       <ScrollViewer Margin="0" Focusable="false" >
                                   <ColumnDefinition Width="80*" />
                                   <ColumnDefinition Width="Auto" MinWidth="{TemplateBinding MinWidth}"/>
                               <StackPanel Margin="2" IsItemsHost="True">
                               <ScrollBar Orientation="Vertical" Margin="0,0" HorizontalAlignment="Right" Grid.Column="1">
                                           <Track x:Name="PART_Track">
                                                   <RepeatButton Background="{x:Null}"/>
                                                   <RepeatButton Background="{x:Null}" />
                                                   <Thumb Background="Gray" />

                   <Trigger Property="IsGrouping" Value="true">
                       <Setter Property="ScrollViewer.CanContentScroll" Value="false"/>

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900