gauge.xaml
<UserControl x:Class="WpfApplication5.gauge"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300"
xmlns:gauge="clr-namespace:CircularGauge;assembly=CircularGauge">
<Grid>
<gauge:CircularGaugeControl x:Name="myGauge1" Grid.Column="0" Grid.Row="0"
Radius="75"
ScaleRadius="55"
ScaleStartAngle="180"
CurrentValue="{Binding Score}"
ScaleSweepAngle="180"
PointerLength="35"
PointerCapRadius="15"
MinValue="0"
MaxValue="100"
MajorDivisionsCount="10"
MinorDivisionsCount="5"
ImageSize="20,30"
RangeIndicatorThickness="0"
RangeIndicatorRadius="56"
ScaleLabelRadius="65"
ScaleLabelSize="18,10"
ScaleLabelFontSize="8"
ScaleLabelForeground="White"
MajorTickSize="8,3"
MinorTickSize="3,1"
MajorTickColor="White"
MinorTickColor="LightGray"
GaugeBackgroundColor="Gray"
PointerThickness ="5"
OptimalRangeStartValue="30"
OptimalRangeEndValue="90"
DialTextOffset="20"
DialTextColor="Black" >
</gauge:CircularGaugeControl>
</Grid>
</UserControl>
备注:
- Background 背景色设置,背景颜色会自动创建一个渐变和玻璃效果。
- ScaleRadius 刻度位置的半径值,根据自己需要进行调制半径值达到调整刻度位置的目的。
- ScaleLabelRadius 刻度标签的半径值。
- RangeIndicatorRadius 刻度范围指示器的半径、
- ImageOffset 外置图片的位置偏移。
- DialTextOffset 标识的文本控件位置偏移。
- DialText 文本内容,比如本文设置为 “mA”。
- RangeIndicatorLightOffset 范围指示灯的位置偏移。
- OptimalRangeStartValue 最佳范围的起始值,与OptimalRangeEndValue一起搭配使用
- OptimalRangeEndValue 最佳范围的终止值。
Radius="75" 表盘的半径值
ScaleRadius="55" 刻度位置的半径值
ScaleStartAngle="180" 表盘刻度起始的位置
CurrentValue="{Binding Score}" 表盘值
ScaleSweepAngle="180" 表盘角度的覆盖范围。最大360度
PointerLength="35" 指针的长度
PointerCapRadius="15" 表盘中心原点的半径
MinValue="0" 刻度最小值
MaxValue="100" 刻度最大值
MajorDivisionsCount="10" 主盘刻度间隔10
MinorDivisionsCount="5" 副盘刻度间隔50.......................................
ImageSize="20,30"
RangeIndicatorThickness="0" 范围指示器 线粗
RangeIndicatorRadius="56" 范围指示器的半径
ScaleLabelRadius="65" 刻度标签的半径值
ScaleLabelSize="18,10" 刻度标签的大小
ScaleLabelFontSize="8" 刻度标签字体的大小
ScaleLabelForeground="White" 刻度标签字体的颜色
MajorTickSize="8,3"
MinorTickSize="3,1"
MajorTickColor="White"
MinorTickColor="LightGray"
GaugeBackgroundColor="Gray"
PointerThickness ="5"
OptimalRangeStartValue="30"
OptimalRangeEndValue="90"
DialTextOffset="20"
DialTextColor="Black" >