Hi,
Welcome to Microsoft Q&A!
By testing, the way that setting SolidColorBrush of your mentioned link works well, which also works on horizontal scroll thumb.
For the width of thumb, you could change it through ViewportSize
.
Please check the following steps:
- Open the Document Outline pane, right-click your ScrollViewer control.
- Choose the option Edit Template > Edit a Copy. Then a default style of the ScrollViewer control will be applied to your ScrollViewer control.
- Find the ScrollBar control named
HorizontalScrollBar
. Then change the ViewportSize.
Please refer to the following code:
<Page …>
<Page.Resources>
<Style x:Key="ScrollViewerStyle1" TargetType="ScrollViewer">
…….
<ScrollBar x:Name="HorizontalScrollBar" IsTabStop="False" Maximum="{TemplateBinding ScrollableWidth}" Orientation="Horizontal" Grid.Row="1" ViewportSize="10" Value="{TemplateBinding HorizontalOffset}" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}"/>
…….
</Style>
</Page.Resources>
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
<ScrollViewer Style="{StaticResource ScrollViewerStyle1}"
HorizontalScrollMode="Enabled" HorizontalScrollBarVisibility="Visible"
Height="200" Width="200">
<ScrollViewer.Resources>
<SolidColorBrush x:Key="ScrollBarThumbFill" Color="Gold"/>
<SolidColorBrush x:Key="ScrollBarThumbFillPointerOver" Color="Orange"/>
<SolidColorBrush x:Key="ScrollBarThumbFillPressed" Color="Red"/>
<SolidColorBrush x:Key="ScrollBarThumbFillDisabled" Color="Pink"/>
</ScrollViewer.Resources>
<Image Source="Assets/testP.jpg" Height="400" Width="400"/>
</ScrollViewer>
</Grid>
</Page>
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.