Wednesday, 21 August 2013

WPF- filling color to polyline in for wpf toolkit

WPF- filling color to polyline in for wpf toolkit

I have created a custom LineSeries graph using a polyline. Below image has
plotted two graph ranged from 0-1 and 1.2 to 2 against the date and time.
It demo the expected graph output. I have data structure where I will get
the data from 0-1 and 1.2 to 2.
My problem is I am not able to fill the color when the point is constantly
read 1 till the next drop to 0.
Here is my style
<customSeries:StepLineSeries.Style>
<Style TargetType="customSeries:StepLineSeries">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="customSeries:StepLineSeries">
<Canvas x:Name="PlotArea" >
<Border BorderThickness="0" Background="{Binding
DataContext.SeriesForeColor,
RelativeSource={RelativeSource Mode=FindAncestor,
AncestorType={x:Type customSeries:StepLineSeries}},
Converter={StaticResource TextToBrushConverter}}">
<Polyline DataContext="{Binding Tag,
RelativeSource={RelativeSource AncestorType={x:Type
customSeries:StepLineSeries}}}"
Points="{TemplateBinding Points}" Stroke="{Binding
DataContext.SeriesForeColor}" Fill="White"/>
</Border>
</Canvas>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</customSeries:StepLineSeries.Style>
To Do that I have used Border in the canvas I am filling the color to the
border and making Polyline fill to white always. This approach will not
work for all the case. Can anyone suggest something better than this to
fill the color other than polyline fill

No comments:

Post a Comment