兼容win7版应用
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

149 lines
6.5 KiB

<UserControl x:Class="AIK.Views.MenuPages.CommonPage.SemiCircleGauge"
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"
xmlns:local="clr-namespace:AIK.Views.MenuPages.CommonPage"
xmlns:convert="clr-namespace:AIK.Views.Converters"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<convert:DoubleToDiameterConverter x:Key="DoubleToDiameterConverter"/>
</UserControl.Resources>
<Grid>
<Canvas Width="400" Height="400" Background="Transparent">
<!-- 外圆环 -->
<Path Data="{Binding OuterArcGeometry}"
Stroke="#757575" StrokeThickness="2" Fill="Transparent"/>
<!-- 进度弧 -->
<!--<Path Data="{Binding ProgressArcGeometry}"
Stroke="#FF4081" StrokeThickness="2" Fill="Transparent"/>-->
<!-- 大刻度线 -->
<ItemsControl ItemsSource="{Binding MajorScalePoints}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Line X1="{Binding X1}" Y1="{Binding Y1}" X2="{Binding X2}" Y2="{Binding Y2}"
Stroke="#888888" StrokeThickness="2"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- 小刻度线 -->
<ItemsControl ItemsSource="{Binding MinorScalePoints}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Line X1="{Binding X1}" Y1="{Binding Y1}" X2="{Binding X2}" Y2="{Binding Y2}"
Stroke="#888888" StrokeThickness="1"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- 刻度值 -->
<ItemsControl ItemsSource="{Binding ScaleLabels}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas/>
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="Canvas.Left" Value="{Binding X}"/>
<Setter Property="Canvas.Top" Value="{Binding Y}"/>
</Style>
</ItemsControl.ItemContainerStyle>
<ItemsControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Text}" Foreground="#888888" FontSize="12"/>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<!-- 钟表指针 - 关键修正:移除RenderTransformOrigin,使用正确的旋转中心 -->
<Polygon Points="{Binding NeedlePoints}"
Fill="#FF5722" Stroke="#C41E3A" StrokeThickness="1">
<Polygon.RenderTransform>
<RotateTransform Angle="{Binding NeedleAngle}"
CenterX="200"
CenterY="200"/>
</Polygon.RenderTransform>
</Polygon>
<!-- 中心圆点 -->
<Ellipse Width="12" Height="12" Fill="#FF5722" Stroke="#C41E3A" StrokeThickness="1"
Canvas.Left="194" Canvas.Top="194"/>
<Ellipse Width="6" Height="6" Fill="#FFFFFF" Stroke="#C41E3A" StrokeThickness="1"
Canvas.Left="197" Canvas.Top="197"/>
<!-- 数值显示 -->
<TextBlock Canvas.Left="175" Canvas.Top="220"
FontSize="16" FontWeight="Bold" Foreground="#999999"
Text="{Binding CircleGauge.Value, StringFormat={}{0:F2}}"/>
<TextBlock Canvas.Left="230" Canvas.Top="210"
FontSize="12" Foreground="#666"
Text="{Binding CircleGauge.Unit}"/>
<TextBlock Canvas.Left="190" Canvas.Top="120"
FontSize="12" Foreground="#666"
Text="AIK"/>
<Grid Canvas.Left="130" Canvas.Top="260" >
<Grid.RowDefinitions>
<RowDefinition Height="Auto"></RowDefinition>
<RowDefinition Height="Auto"></RowDefinition>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"></ColumnDefinition>
<ColumnDefinition Width="*"></ColumnDefinition>
</Grid.ColumnDefinitions>
<!--<TextBlock Canvas.Left="130" Canvas.Top="260"
FontSize="20" Foreground="#333"
Text="{DynamicResource Frequency}"/>
<TextBlock Canvas.Left="200" Canvas.Top="260"
FontSize="20" Foreground="#2196F3"
FontWeight="SemiBold"
Text="{Binding CircleGauge.Value, StringFormat={}{0:F2} HZ}"/>
<TextBlock Canvas.Left="130" Canvas.Top="290"
FontSize="20" Foreground="#333"
Text="模式:"/>
<TextBlock Canvas.Left="200" Canvas.Top="290"
FontSize="20" Foreground="#2196F3"
FontWeight="SemiBold"
Text="- - -"/>-->
<TextBlock Grid.Row="0" Grid.Column="0"
FontSize="20" Foreground="#333"
Text="{DynamicResource Frequency}"/>
<TextBlock Grid.Row="0" Grid.Column="1"
FontSize="20" Foreground="#2196F3"
FontWeight="SemiBold"
Text="{Binding CircleGauge.Value, StringFormat={}{0:F2} HZ}"/>
<TextBlock Grid.Row="1" Grid.Column="0"
FontSize="20" Foreground="#333"
Text="{DynamicResource Mode}"/>
<TextBlock Grid.Row="1" Grid.Column="1"
FontSize="20" Foreground="#2196F3"
FontWeight="SemiBold"
Text="- - -"/>
</Grid>
</Canvas>
</Grid>
</UserControl>