WPF Style-2-

Site Index

データポイントのソース定義




Style[] w_style = new Style[10];
for (int idx2 = 0; idx2 < 10; idx2++)
{
w_style[idx2] = new Style(typeof(ScatterDataPoint));
}
w_style[0].Setters.Add(new Setter(ScatterDataPoint.BackgroundProperty, new SolidColorBrush(Colors.Yellow)));
w_style[1].Setters.Add(new Setter(ScatterDataPoint.BackgroundProperty, new SolidColorBrush(Colors.Pink)));
    ・
    ・
    ・
while (w_Reader.Read())
{
//*******************************
// chart
//*******************************
    ・
    ・
    ・
//**styleテスト
//**Style w_style = new Style(typeof(ScatterDataPoint));
//**w_style.Setters.Add(new Setter(ScatterDataPoint.BackgroundProperty,new SolidColorBrush(Colors.Yellow)));
w_scatterSeries[idx].DataPointStyle = w_style[idx];
idx++;
}

リソース定義使用




<Window.Resources>
<Style x:Key="xaml_PolylineStyle_3" TargetType="Polyline">
<Setter Property="StrokeThickness" Value="3"/>
</Style>
<Style x:Key="xaml_PolylineStyle_5" TargetType="Polyline">
<Setter Property="StrokeThickness" Value="6"/>
</Style>
</Window.Resources>




w_lineSeries[idx].PolylineStyle = (Style)(this.Resources["xaml_PolylineStyle_3"]);
w_lineSeries[idx].MouseEnter += new MouseEventHandler(MainWindow_MouseEnter);
w_lineSeries[idx].MouseLeave += new MouseEventHandler(MainWindow_MouseLeave);




AX