终端一体化运控平台
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.
 
 
 

82 line
3.4 KiB

  1. <UserControl
  2. x:Class="BPASmartClient.CustomResource.UserControls.Instrument"
  3. xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="clr-namespace:BPASmartClient.CustomResource.UserControls"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. d:DesignHeight="450"
  9. d:DesignWidth="800"
  10. mc:Ignorable="d">
  11. <Grid>
  12. <Ellipse x:Name="backEllipse" Fill="{Binding PlateBackground, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}" />
  13. <!-- 画布 -->
  14. <Canvas
  15. x:Name="mainCanvas"
  16. Width="{Binding Width, ElementName=backEllipse}"
  17. Height="{Binding Height, ElementName=backEllipse}" />
  18. <!-- 圆弧 -->
  19. <Path
  20. Name="Circle"
  21. Width="{Binding Width, ElementName=backEllipse}"
  22. Height="{Binding Height, ElementName=backEllipse}"
  23. Data=""
  24. RenderTransformOrigin="0.5 0.5"
  25. Stroke="White"
  26. StrokeEndLineCap="Round"
  27. StrokeStartLineCap="Round"
  28. StrokeThickness="4">
  29. <Path.RenderTransform>
  30. <RotateTransform Angle="-45" />
  31. </Path.RenderTransform>
  32. </Path>
  33. <!-- 指针 -->
  34. <Path
  35. Name="pointer"
  36. Width="{Binding Width, ElementName=backEllipse}"
  37. Height="{Binding Height, ElementName=backEllipse}"
  38. Data=""
  39. Fill="{Binding PointerColor, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}"
  40. RenderTransformOrigin="0.5 0.5">
  41. <Path.RenderTransform>
  42. <RotateTransform x:Name="rtPointer" Angle="-45" />
  43. </Path.RenderTransform>
  44. </Path>
  45. <!-- 圆心 -->
  46. <Border
  47. Width="30"
  48. Height="30"
  49. CornerRadius="15">
  50. <Border.Background>
  51. <RadialGradientBrush>
  52. <GradientStop Offset="0.583" Color="White" />
  53. <GradientStop Offset="1" Color="#ff97b5bd" />
  54. </RadialGradientBrush>
  55. </Border.Background>
  56. </Border>
  57. <!-- 显示文本和单位 -->
  58. <StackPanel
  59. Margin="0,0,0,40"
  60. HorizontalAlignment="Center"
  61. VerticalAlignment="Bottom"
  62. Orientation="Horizontal">
  63. <TextBlock
  64. Background="Transparent"
  65. FontSize="{Binding ScaleTextSize, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}"
  66. Foreground="{Binding ScaleBrush, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}"
  67. Text="{Binding Value, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}" />
  68. <TextBlock
  69. Margin="5,0,0,0"
  70. Background="Transparent"
  71. FontSize="{Binding ScaleTextSize, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}"
  72. Foreground="{Binding ScaleBrush, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}"
  73. Text="{Binding Unit, RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}}" />
  74. </StackPanel>
  75. </Grid>
  76. </UserControl>