Thank you for your answers! I found in custom line symbols one symbol which may work for me:
<esri:LineSymbol x:Key="CustomRedYellowLineSymbol" Width="4">
<esri:LineSymbol.Color>
<LinearGradientBrush StartPoint="0,0" EndPoint="4,4" MappingMode="Absolute" SpreadMethod="Repeat">
<GradientStop Color="Red" Offset="0.5" />
<GradientStop Color="Yellow" Offset="0.5" />
</LinearGradientBrush>
</esri:LineSymbol.Color>
</esri:LineSymbol>
The question is now, how to implement it into code in a way I can still use Visual States (I would like still to be able to highlight my line, when the mouse is over it).
Here is my original code:
<esri:SimpleLineSymbol x:Key="2_D2DRouteLineSymbol">
<esri:SimpleLineSymbol.ControlTemplate>
<ControlTemplate x:Name="D2DRoute2SymbolTemplate">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="D2DRoute2SelectionGroup">
<VisualState x:Name="Normal">
<Storyboard>
<ColorAnimation Storyboard.TargetName="Element"
Storyboard.TargetProperty="(Stroke).(Color)"
To="#FF6600" Duration="0:0:0.1" />
</Storyboard>
</VisualState>
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimation Storyboard.TargetName="Element"
Storyboard.TargetProperty="(Stroke).(Color)"
To="Cyan" Duration="0:0:0.1" />
</Storyboard>
</VisualState>
<VisualState x:Name="Selected">
<Storyboard>
<ColorAnimation Storyboard.TargetName="Element"
Storyboard.TargetProperty="(Stroke).(Color)"
To="Cyan" Duration="0:0:0.1" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Path x:Name="Element" Stroke="Aqua" Fill="{x:Null}" StrokeStartLineCap="Round" StrokeThickness="4" StrokeLineJoin="Round" StrokeEndLineCap="Round" />
</Grid>
</ControlTemplate>
</esri:SimpleLineSymbol.ControlTemplate>
</esri:SimpleLineSymbol>
I tried to past sample into few different places, but everything what I was able to do is:
<esri:SimpleLineSymbol x:Key="1_D2DRouteLineSymbol" Width="4">
esri:LineSymbol.Color>
<LinearGradientBrush StartPoint="0,0" EndPoint="4,4" MappingMode="Absolute" SpreadMethod="Repeat">
<GradientStop Color="#0033FF" Offset="0.5" />
<GradientStop Color="#FFFFFF" Offset="0.5" />
</LinearGradientBrush>
</esri:LineSymbol.Color>
</esri:SimpleLineSymbol>
Which does not allows me for any highlighting.