Style dataPointStyle = new System.Windows.Style();
dataPointStyle.TargetType = typeof(System.Windows.Controls.Control);
Style LegendStyle = new System.Windows.Style();
LegendStyle.TargetType = typeof(System.Windows.Controls.Control);
Setter setterDataRed = new Setter(System.Windows.Controls.Control.BackgroundProperty, new SolidColorBrush(Colors.Red));
Setter setterLegendRed = new Setter(System.Windows.Controls.Control.BackgroundProperty, new SolidColorBrush(Colors.Red));
dataPointStyle.Setters.Add(setterDataRed);
LegendStyle.Setters.Add(setterLegendRed);
lineSeries11.DataPointStyle = dataPointStyle;
lineSeries11.LegendItemStyle = LegendStyle;
dataPointStyle.TargetType = typeof(System.Windows.Controls.Control);
Style LegendStyle = new System.Windows.Style();
LegendStyle.TargetType = typeof(System.Windows.Controls.Control);
Setter setterDataRed = new Setter(System.Windows.Controls.Control.BackgroundProperty, new SolidColorBrush(Colors.Red));
Setter setterLegendRed = new Setter(System.Windows.Controls.Control.BackgroundProperty, new SolidColorBrush(Colors.Red));
dataPointStyle.Setters.Add(setterDataRed);
LegendStyle.Setters.Add(setterLegendRed);
lineSeries11.DataPointStyle = dataPointStyle;
lineSeries11.LegendItemStyle = LegendStyle;
本文介绍如何使用WPF为图表中的数据点和图例项设置样式。通过定义样式并应用到LineSeries的数据点和图例中,可以实现统一且美观的图表外观。具体包括设置背景颜色为红色。
3158

被折叠的 条评论
为什么被折叠?



