This example shows how to create a custom series model and change the selection color for series points.
-
Create an object that represents a custom model of a particular series CustomBar2DModel and assign it to the
Model
property of a corresponding series type (BarSeries2D.Model). -
Create the
System.Windows.Controls.ControlTemplate
object which contains a Border element to create your own custom model. -
Assign this template to the
PointTemplate
property of a custom series model (CustomBar2DModel.PointTemplate). -
Create the
IsSelectedConverter
. For this, create theIsSelectedToBrushConverter
class inherited fromIValueConverter
. Then, implementConvert
andConvertBack
methods. TheConvert
method returns black if theIsSelected
value istrue
; otherwise, red. -
Bind the
Border.Background
property to the SeriesPointPresentationData.IsSelected property withIsSelectedToBrushConverter
from the static resource. Set the ChartControl.SelectionMode property toMultiple
to enable chart selection.