OilAnalogView.axaml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <UserControl
  2. x:Class="ShakerApp.Views.OilAnalogView"
  3. xmlns="https://github.com/avaloniaui"
  4. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  5. xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  6. xmlns:local="using:ShakerApp"
  7. xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8. xmlns:vm="using:ShakerApp.ViewModels"
  9. Height="140"
  10. d:DesignHeight="450"
  11. d:DesignWidth="800"
  12. x:DataType="vm:OilSourceAnalogViewModel"
  13. mc:Ignorable="d">
  14. <StackPanel
  15. MinWidth="220"
  16. HorizontalAlignment="Center"
  17. VerticalAlignment="Center">
  18. <StackPanel
  19. HorizontalAlignment="Center"
  20. VerticalAlignment="Center"
  21. Orientation="Horizontal">
  22. <TextBlock
  23. HorizontalAlignment="Center"
  24. VerticalAlignment="Center"
  25. FontSize="36"
  26. Foreground="{StaticResource OilDefaultColor}"
  27. Text="{local:ResourceBinding Name}" />
  28. <PathIcon
  29. Width="32"
  30. Height="24"
  31. Margin="10,0,0,0"
  32. VerticalAlignment="Center"
  33. Classes.IsError="{Binding IsError}"
  34. Classes.IsWarn="{Binding IsWarn}"
  35. Data="M16,0 L32,24 L0,24Z"
  36. IsVisible="{Binding IsUpper}">
  37. <PathIcon.Styles>
  38. <Style Selector="PathIcon">
  39. <Setter Property="Foreground" Value="{StaticResource OilDefaultColor}" />
  40. </Style>
  41. <Style Selector="PathIcon.IsError">
  42. <Setter Property="Foreground" Value="{StaticResource ErrorColor}" />
  43. </Style>
  44. <Style Selector="PathIcon.IsWarn">
  45. <Setter Property="Foreground" Value="{StaticResource WarnColor}" />
  46. </Style>
  47. </PathIcon.Styles>
  48. </PathIcon>
  49. <PathIcon
  50. Width="32"
  51. Height="24"
  52. HorizontalAlignment="Right"
  53. VerticalAlignment="Center"
  54. Classes.IsError="{Binding IsError}"
  55. Classes.IsWarn="{Binding IsWarn}"
  56. Data="M0,0 L32,0 L16,24Z"
  57. IsVisible="{Binding IsLower}">
  58. <PathIcon.Styles>
  59. <Style Selector="PathIcon">
  60. <Setter Property="Foreground" Value="{StaticResource OilDefaultColor}" />
  61. </Style>
  62. <Style Selector="PathIcon.IsError">
  63. <Setter Property="Foreground" Value="{StaticResource ErrorColor}" />
  64. </Style>
  65. <Style Selector="PathIcon.IsWarn">
  66. <Setter Property="Foreground" Value="{StaticResource WarnColor}" />
  67. </Style>
  68. </PathIcon.Styles>
  69. </PathIcon>
  70. </StackPanel>
  71. <TextBlock
  72. HorizontalAlignment="Center"
  73. VerticalAlignment="Center"
  74. Classes.IsError="{Binding IsError}"
  75. Classes.IsWarn="{Binding IsWarn}"
  76. FontSize="74"
  77. FontWeight="Bold">
  78. <Run Text="{Binding Value, StringFormat='{}{0:0.00} '}" />
  79. <Run Text="{Binding Unit}" />
  80. <TextBlock.Styles>
  81. <Style Selector="TextBlock">
  82. <Setter Property="Foreground" Value="{StaticResource OilDefaultColor}" />
  83. </Style>
  84. <Style Selector="TextBlock.IsError">
  85. <Setter Property="Foreground" Value="{StaticResource ErrorColor}" />
  86. </Style>
  87. <Style Selector="TextBlock.IsWarn">
  88. <Setter Property="Foreground" Value="{StaticResource WarnColor}" />
  89. </Style>
  90. </TextBlock.Styles>
  91. </TextBlock>
  92. </StackPanel>
  93. </UserControl>