Try following code with LinearGradientBrush:
XAML:
<Window x:Class="Window110"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfApp1.WpfApp110"
mc:Ignorable="d"
Title="Window110" Height="300" Width="200" Loaded="Window_Loaded">
<Window.Resources>
<local:ValueConverter x:Key="conv1"/>
<local:ColorConverter x:Key="conv2"/>
</Window.Resources>
<Grid>
<TextBlock Text="{Binding Value, ElementName=sl, Converter={StaticResource conv1}}"
Foreground="{Binding Value, ElementName=sl, Converter={StaticResource conv2}}"
FontSize="200" FontWeight="ExtraBlack"
Margin="35 0 30 30" />
<Slider x:Name="sl" Minimum="0" Maximum="5" Height="20" VerticalAlignment="Bottom"/>
</Grid>
</Window>
Code:
Imports System.Globalization
Public Class Window110
Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs)
Me.DataContext = Me
End Sub
End Class
Namespace WpfApp110
Public Class ValueConverter
Implements IValueConverter
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
Dim x = CType(value.ToString, Integer)
Return x.ToString
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
Public Class ColorConverter
Implements IValueConverter
Public Sub New()
b.StartPoint = New Point(0.5, 1)
b.EndPoint = New Point(0.5, 0)
b.GradientStops.Add(stop1)
b.GradientStops.Add(stop2)
b.GradientStops.Add(stop3)
b.GradientStops.Add(stop4)
End Sub
Private b As New LinearGradientBrush()
Private stop1 As New GradientStop(Colors.Blue, 0)
Private stop2 As New GradientStop(Colors.Blue, 0.001)
Private stop3 As New GradientStop(Colors.Yellow, 0.001)
Private stop4 As New GradientStop(Colors.Yellow, 1)
Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.Convert
Dim x = CType(value.ToString, Double) / 5
stop2.Offset = x
stop3.Offset = x + 0.001
Return b
End Function
Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
Throw New NotImplementedException()
End Function
End Class
End Namespace
Result: