104 lines
4.9 KiB
Plaintext
104 lines
4.9 KiB
Plaintext
|
|
<UserControl x:Class="OperationControl.Controls.TemperatureIndicator"
|
||
|
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||
|
|
xmlns:conv="clr-namespace:OperationControl.Converters"
|
||
|
|
x:Name="Root"
|
||
|
|
MinHeight="64" MinWidth="240">
|
||
|
|
<UserControl.Resources>
|
||
|
|
<!-- Paleta -->
|
||
|
|
<SolidColorBrush x:Key="BarBack" Color="#222"/>
|
||
|
|
<SolidColorBrush x:Key="BarBorder" Color="#404040"/>
|
||
|
|
<SolidColorBrush x:Key="MarkBrush" Color="#FFFFFF"/>
|
||
|
|
|
||
|
|
<conv:TempRangeToBrushConverter x:Key="TempRangeToBrushConverter"/>
|
||
|
|
<conv:TempValueToWidthConverter x:Key="TempValueToWidthConverter"/>
|
||
|
|
</UserControl.Resources>
|
||
|
|
|
||
|
|
<Grid Margin="6,4">
|
||
|
|
<Grid.RowDefinitions>
|
||
|
|
<RowDefinition Height="Auto"/>
|
||
|
|
<RowDefinition Height="8"/>
|
||
|
|
<RowDefinition Height="Auto"/>
|
||
|
|
</Grid.RowDefinitions>
|
||
|
|
|
||
|
|
<!-- Cabeçalho: Label + Valor grande -->
|
||
|
|
<DockPanel Grid.Row="0" LastChildFill="False">
|
||
|
|
<TextBlock Text="{Binding Label, ElementName=Root}"
|
||
|
|
Foreground="#DDD" Opacity="0.9"
|
||
|
|
FontSize="13" VerticalAlignment="Center"
|
||
|
|
Margin="0,0,8,0"/>
|
||
|
|
<Border Background="#333" CornerRadius="6" Padding="10,2" >
|
||
|
|
<TextBlock>
|
||
|
|
<Run Text="{Binding Value, ElementName=Root, StringFormat={}{0:0.0}}"/>
|
||
|
|
<Run Text="{Binding Units, ElementName=Root}"/>
|
||
|
|
</TextBlock>
|
||
|
|
</Border>
|
||
|
|
</DockPanel>
|
||
|
|
|
||
|
|
<!-- Barra de temperatura -->
|
||
|
|
<Grid Grid.Row="2">
|
||
|
|
<Grid.RowDefinitions>
|
||
|
|
<RowDefinition Height="Auto"/>
|
||
|
|
<RowDefinition Height="4"/>
|
||
|
|
<RowDefinition Height="Auto"/>
|
||
|
|
</Grid.RowDefinitions>
|
||
|
|
|
||
|
|
<!-- Barra -->
|
||
|
|
<Grid Grid.Row="0" Height="20" VerticalAlignment="Center">
|
||
|
|
<!-- Fundo / borda -->
|
||
|
|
<Border Background="{StaticResource BarBack}"
|
||
|
|
CornerRadius="6"
|
||
|
|
BorderBrush="{StaticResource BarBorder}"
|
||
|
|
BorderThickness="1"/>
|
||
|
|
|
||
|
|
<!-- Faixa dinâmica (cor troca por thresholds) -->
|
||
|
|
<Rectangle x:Name="FillRect"
|
||
|
|
RadiusX="6" RadiusY="6"
|
||
|
|
HorizontalAlignment="Left" Height="20">
|
||
|
|
<Rectangle.Fill>
|
||
|
|
<MultiBinding Converter="{StaticResource TempRangeToBrushConverter}">
|
||
|
|
<Binding ElementName="Root" Path="Value"/>
|
||
|
|
<Binding ElementName="Root" Path="WarnStart"/>
|
||
|
|
<Binding ElementName="Root" Path="CritStart"/>
|
||
|
|
</MultiBinding>
|
||
|
|
</Rectangle.Fill>
|
||
|
|
<Rectangle.Width>
|
||
|
|
<MultiBinding Converter="{StaticResource TempValueToWidthConverter}">
|
||
|
|
<Binding ElementName="Root" Path="Value"/>
|
||
|
|
<Binding ElementName="Root" Path="Min"/>
|
||
|
|
<Binding ElementName="Root" Path="Max"/>
|
||
|
|
<Binding RelativeSource="{RelativeSource AncestorType=Grid}" Path="ActualWidth"/>
|
||
|
|
</MultiBinding>
|
||
|
|
</Rectangle.Width>
|
||
|
|
</Rectangle>
|
||
|
|
|
||
|
|
<!-- Marcador (triângulo) na ponta do valor -->
|
||
|
|
<Grid IsHitTestVisible="False">
|
||
|
|
<Polygon Points="0,0 10,0 5,8"
|
||
|
|
Fill="{StaticResource MarkBrush}"
|
||
|
|
HorizontalAlignment="Left" VerticalAlignment="Top"
|
||
|
|
Margin="0,-8,0,0">
|
||
|
|
<Polygon.RenderTransform>
|
||
|
|
<TranslateTransform x:Name="MarkerTT"/>
|
||
|
|
</Polygon.RenderTransform>
|
||
|
|
</Polygon>
|
||
|
|
</Grid>
|
||
|
|
</Grid>
|
||
|
|
|
||
|
|
<!-- Escala mínima / máxima (opcional, sutil) -->
|
||
|
|
<DockPanel Grid.Row="2" Margin="2,4,2,0" LastChildFill="True" Opacity="0.75">
|
||
|
|
<TextBlock Text="{Binding Min, ElementName=Root, StringFormat={}{0:0}}" Foreground="#AAA"/>
|
||
|
|
<TextBlock Text="{Binding Max, ElementName=Root, StringFormat={}{0:0}}"
|
||
|
|
Foreground="#AAA" HorizontalAlignment="Right">
|
||
|
|
<TextBlock.RenderTransform>
|
||
|
|
<TranslateTransform X="{Binding ActualWidth, RelativeSource={RelativeSource AncestorType=Grid}}"/>
|
||
|
|
</TextBlock.RenderTransform>
|
||
|
|
</TextBlock>
|
||
|
|
</DockPanel>
|
||
|
|
</Grid>
|
||
|
|
|
||
|
|
<!-- Animação de alerta (leve brilho quando crítico) -->
|
||
|
|
<Border Grid.RowSpan="3" CornerRadius="8" Background="#00FFFFFF" x:Name="AlertGlow" IsHitTestVisible="False"/>
|
||
|
|
</Grid>
|
||
|
|
</UserControl>
|