CtrEditor/ObjetosSim/Emuladores/ucTanque.xaml

54 lines
2.4 KiB
Plaintext
Raw Normal View History

2024-05-14 13:17:46 -03:00
<UserControl x:Class="CtrEditor.ObjetosSim.ucTanque"
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:CtrEditor.ObjetosSim"
mc:Ignorable="d"
xmlns:vm="clr-namespace:CtrEditor.ObjetosSim"
2024-05-14 13:17:46 -03:00
xmlns:convert="clr-namespace:CtrEditor.Convertidores">
<UserControl.Resources>
<convert:MeterToPixelConverter x:Key="MeterToPixelConverter"/>
<convert:LevelToHeightMultiConverter x:Key="LevelToHeightMultiConverter"/>
<convert:WidthPercentageConverter x:Key="WidthPercentageConverter"/>
</UserControl.Resources>
<UserControl.DataContext>
<vm:osTanque Alto="1" Ancho="1" Angulo="-4" />
</UserControl.DataContext>
2024-05-14 13:17:46 -03:00
<Grid>
<Image x:Name="TankImage"
2024-05-16 13:45:14 -03:00
Source="/imagenes/tank.png"
2024-05-27 05:34:20 -03:00
Width="{Binding Ancho, Converter={StaticResource MeterToPixelConverter}}"
Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}"
Stretch="Uniform">
</Image>
<Slider
HorizontalAlignment="Left"
VerticalAlignment="Center"
Height="{Binding Alto, Converter={StaticResource MeterToPixelConverter}}"
Orientation="Vertical"
Value="{Binding Level}"
Maximum="100"/>
2024-05-14 13:17:46 -03:00
<Rectangle x:Name="WaterLevel"
Fill="Blue"
VerticalAlignment="Bottom"
HorizontalAlignment="Center">
<Rectangle.Width>
<Binding ElementName="TankImage" Path="ActualWidth" Converter="{StaticResource WidthPercentageConverter}" />
</Rectangle.Width>
<Rectangle.Height>
<MultiBinding Converter="{StaticResource LevelToHeightMultiConverter}">
<Binding Path="Level" />
<Binding ElementName="TankImage" Path="ActualHeight" />
</MultiBinding>
</Rectangle.Height>
</Rectangle>
2024-05-14 13:17:46 -03:00
<Label Content="{Binding Level}" HorizontalAlignment="Center" Margin="10,10,0,0" VerticalAlignment="Top"/>
</Grid>
</UserControl>