SlunkCrypt/gui/Controls/ImageToggleButton.xaml

22 lines
1.4 KiB
Plaintext
Raw Permalink Normal View History

<UserControl x:Class="com.muldersoft.slunkcrypt.gui.ctrls.ImageToggleButton"
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:utils="clr-namespace:com.muldersoft.slunkcrypt.gui.utils"
mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800">
<UserControl.Resources>
<utils:VisibilityConverter x:Key="VisibilityConverter1"/>
<utils:VisibilityConverter x:Key="VisibilityConverter2" Inverse="True"/>
</UserControl.Resources>
<ToggleButton x:Name="Toggle">
<Grid>
<Image Margin="4,0,4,0" Style="{StaticResource GrayOutIfDisabled}" Stretch="None" Visibility="{Binding IsChecked, RelativeSource={RelativeSource FindAncestor, AncestorType=ToggleButton}, Converter={StaticResource VisibilityConverter2}}" Name="Image_Default"/>
<Image Margin="4,0,4,0" Style="{StaticResource GrayOutIfDisabled}" Stretch="None" Visibility="{Binding IsChecked, RelativeSource={RelativeSource FindAncestor, AncestorType=ToggleButton}, Converter={StaticResource VisibilityConverter1}}" Name="Image_Checked"/>
</Grid>
</ToggleButton>
</UserControl>