<Application x:Class="com.muldersoft.slunkcrypt.gui.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="SlunkCryptGUI.xaml">
    
    <Application.Resources>
        <Style TargetType="{x:Type FrameworkElement}" x:Key="DisableWhileBusy">
            <Setter Property="IsEnabled" Value="true"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsBusy, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" Value="true">
                    <Setter Property="IsEnabled" Value="false"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="{x:Type FrameworkElement}" x:Key="EnableWhileBusy">
            <Setter Property="IsEnabled" Value="false"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsBusy, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" Value="true">
                    <Setter Property="IsEnabled" Value="true"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="{x:Type FrameworkElement}" x:Key="HitInvisibleWhileBusy">
            <Setter Property="IsEnabled" Value="true"/>
            <EventSetter Event="PreviewDragEnter"            Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewDragOver"             Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewDrop"                 Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewGotKeyboardFocus"     Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewKeyDown"              Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewKeyUp"                Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewMouseDown"            Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewMouseLeftButtonDown"  Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewMouseLeftButtonUp"    Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewMouseRightButtonDown" Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewMouseRightButtonUp"   Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewMouseUp"              Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewMouseWheel"           Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewStylusButtonDown"     Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewStylusButtonUp"       Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewStylusDown"           Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewStylusInRange"        Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewStylusSystemGesture"  Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewStylusUp"             Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewTextInput"            Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewTouchDown"            Handler="FrameworkElement_PreviewUserInputEvent"/>
            <EventSetter Event="PreviewTouchUp"              Handler="FrameworkElement_PreviewUserInputEvent"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsBusy, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" Value="true">
                    <Setter Property="IsHitTestVisible" Value="false"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="{x:Type FrameworkElement}" x:Key="WaitCursorWhileBusy">
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsBusy, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}" Value="true">
                    <Setter Property="Cursor" Value="Wait"/>
                    <Setter Property="ForceCursor" Value="true"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="{x:Type TextBlock}" x:Key="HighlightIfSelected">
            <Style.Triggers>
                <DataTrigger Binding="{Binding IsSelected, RelativeSource={RelativeSource FindAncestor, AncestorType=TabItem}}" Value="true">
                    <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HotTrackBrushKey}}"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="{x:Type Image}" x:Key="GrayOutIfDisabled">
            <Setter Property="Opacity" Value="1.0"/>
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Opacity" Value="0.5"/>
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="{x:Type FrameworkElement}" x:Key="HideIfNotEmpty">
            <Setter Property="Visibility" Value="Collapsed"/>
            <Style.Triggers>
                <DataTrigger Binding="{Binding Count}" Value="0">
                    <Setter Property="Visibility" Value="Visible"/>
                </DataTrigger>
            </Style.Triggers>
        </Style>
        <Style TargetType="{x:Type ListViewItem}" x:Key="ItemToolTips">
            <Setter Property="ToolTip">
                <Setter.Value>
                    <ToolTip Content="{Binding Chars}"/>
                </Setter.Value>
            </Setter>
        </Style>
    </Application.Resources>
</Application>
