Back to Devexpress

XYSeries.Brush Property

wpf-devexpress-dot-xpf-dot-charts-dot-xyseries-98c9b99d.md

latest2.7 KB
Original Source

XYSeries.Brush Property

Gets or sets the color of the XY-series.

Namespace : DevExpress.Xpf.Charts

Assembly : DevExpress.Xpf.Charts.v25.2.dll

NuGet Package : DevExpress.Wpf.Charts

Declaration

csharp
public SolidColorBrush Brush { get; set; }
vb
Public Property Brush As SolidColorBrush

Property Value

TypeDescription
SolidColorBrush

A SolidColorBrush object that specifies the color of a series.

|

Remarks

Use the following code to set the Brush property:

In Markup:

xaml
<dxc:AreaSeries2D ArgumentScaleType="Numerical" Brush="#43a047">
</dxc:AreaSeries2D>

In Code-Behind:

csharp
XYDiagram2D diagram = (XYDiagram2D)chart.Diagram;
AreaSeries2D series = (AreaSeries2D)diagram.Series[1];
series.Brush = new SolidColorBrush(Color.FromArgb(100, 255, 0, 0));
vb
Dim diagram As XYDiagram2D = CType(chart.Diagram, XYDiagram2D)
Dim series As AreaSeries2D = CType(diagram.Series(1), AreaSeries2D)
series.Brush = New SolidColorBrush(Color.FromArgb(100, 255, 0, 0))

The Brush property does not support Opacity. You can use Color to set the opacity as follows:

csharp
XYDiagram2D diagram = (XYDiagram2D)chart.Diagram;
AreaSeries2D series = (AreaSeries2D)diagram.Series[1];
// Opacity is set to 10%.
Color color = Color.FromArgb(10, series.Brush.Color.R, series.Brush.Color.G, series.Brush.Color.B); 
series.Brush = new SolidColorBrush(color);
vb
Dim diagram As XYDiagram2D = CType(chart.Diagram, XYDiagram2D)
Dim series As AreaSeries2D = CType(diagram.Series(1), AreaSeries2D)
' Opacity is set to 10%.
Dim color As Color = Color.FromArgb(10, series.Brush.Color.R, series.Brush.Color.G, series.Brush.Color.B)
series.Brush = New SolidColorBrush(color)

See Also

XYSeries Class

XYSeries Members

DevExpress.Xpf.Charts Namespace