仪表盘:
可根据数值调整颜色,绿色:正常,黄色:预警、红色:警告。图示仪表盘数值绑定Slider的Value。
依赖属性注册:
[Category("值设定")]
public Brush ShowBrush
{
get { return (Brush)GetValue(ShowBrushPropertyProperty); }
set { SetValue(ShowBrushPropertyProperty, value); }
}
public static readonly DependencyProperty ShowBrushPropertyProperty =
DependencyProperty.Register("ShowBrush", typeof(Brush), typeof(ArcGauge), new PropertyMetadata(Brushes.Green, OnValueChanged));
ShowBrush可在样式中(仪表盘)绑定:
<Ellipse Fill="{Binding ShowBrush,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>