0
我想在我的代碼中更改滾動條大拇指的前景。如何更改wpf中滾動條的縮略圖的前景?
我申請一個風格,改變了我的拇指背景,但是,我想在運行時改變
前景圖像。這裏是我滾動條的樣式代碼。
<ControlTemplate x:Key="MyScrollBar" TargetType="{x:Type ScrollBar}">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="178"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="12" />
<RowDefinition Height="*"/>
<RowDefinition Height="12" />
</Grid.RowDefinitions>
<Border Grid.Row="1" CornerRadius="2" BorderThickness="0" >
<Border.Background>
<ImageBrush ImageSource="/HyperVibe;component/Images/Grey_Slider_Background.png" />
</Border.Background>
</Border>
<RepeatButton Grid.Row="0" Command="ScrollBar.LineUpCommand" Content=" ^" />
<!--IsDirectionReversed set to true draws a ScrollBar with a
Track whose lowest value is at the bottom.
The default orientation of a ScrollBar is for the Track
values to decrease from top to bottom.-->
<Track Grid.Row="1" Name="PART_Track" IsDirectionReversed="true">
<Track.Thumb>
<Thumb BorderThickness="1" DataContext="{Binding}" >
<Thumb.OpacityMask>
<ImageBrush ImageSource="/HyperVibe;component/Images/Green%20Slider.png" />
</Thumb.OpacityMask>
<Thumb.Background>
<ImageBrush ImageSource="/HyperVibe;component/Images/Green%20Slider.png" />
</Thumb.Background>
</Thumb>
</Track.Thumb>
</Track>
<RepeatButton Grid.Row="2" Command="ScrollBar.LineDownCommand" Content=" v" />
</Grid>
</ControlTemplate>
任何幫助將不勝感激。
最好的問候, 〜阿努普