Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to customize the appearance of selected series points

$
0
0
This example shows how to change the selection color for series points. For this, it's necessary to create a custom series model.

To accomplish this, do the following:

1. 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): E4593: How to create custom models for chart series

2. Create the System.Windows.Controls.ControlTemplate object which contains a Border element to create your own custom model.

3. Assign this template to the PointTemplate property of a series custom model (CustomBar2DModel.PointTemplate). 

4. Create the IsSelectedConverter. For this, create the IsSelectedToBrushConverter class inheritted from IValueConverter. Then, implement Convert and ConvertBack methods. The Convert method will return the black color if the IsSelected value is  true and red color -  otherwise.

5. Bind the Border.Background property to the SeriesPointPresentationData.IsSelected property using the IsSelectedToBrushConverter from the static resource. 

Note that the ChartControl.SelectionMode property must be set to Multiple to enable the chart selection. 


Viewing all articles
Browse latest Browse all 7205

Trending Articles