JD2022-TU1/main/tools/modules/Orbit.Module/View/OrbitActionButton.xaml

46 lines
2 KiB
XML

<UserControl x:Class="Orbit.Module.View.OrbitActionButton"
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:converters="clr-namespace:Orbit.Module.Converters"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800"
d:DataContext="{d:DesignData Action}">
<UserControl.Resources>
<!-- Basic style for the button -->
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Foreground" Value="DimGray"/>
</Trigger>
</Style.Triggers>
</Style>
<!-- Icon converter function -->
<converters:IconToImageSourceConverter x:Key="IconToImageConverter"/>
</UserControl.Resources>
<!-- Common Button for the Plume Action -->
<Button Command="{Binding Command}" ToolTip="{Binding Description}" Margin="10" Height="55"
HorizontalContentAlignment="Left" VerticalContentAlignment="Center">
<Grid Margin="5">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="35" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<!-- Icon of the action -->
<Image Grid.Column="0" Source="{Binding Icon, Converter={StaticResource IconToImageConverter}}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="5" />
<!-- Text of the action -->
<TextBlock Grid.Column="1" Text="{Binding Text}" VerticalAlignment="Center" HorizontalAlignment="Left" Margin="20 5 5 5" TextWrapping="Wrap" FontSize="14" />
</Grid>
</Button>
</UserControl>