<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:ui="http://schemas.modernwpf.com/2019">

    <Style x:Key="UWPFocusVisualStyle">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border Margin="-2"
                            CornerRadius="4"
                            BorderThickness="2"
                            BorderBrush="{DynamicResource PrimaryForegroundBrush}" />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <DropShadowEffect x:Key="CardDropShadow"
                      BlurRadius="6"
                      Opacity="0.24"
                      ShadowDepth="1" />

    <Style x:Key="MonitorItemContainerStyle"
           TargetType="ui:GridViewItem">
        <Setter Property="Background"
                Value="{DynamicResource LayoutItemBackgroundBrush}" />
        <Setter Property="IsSelected"
                Value="{Binding Selected, Mode=OneWay}" />
        <Setter Property="AutomationProperties.Name"
                Value="{Binding Index}" />
        <Setter Property="KeyboardNavigation.TabNavigation"
                Value="Local" />
        <Setter Property="MinWidth"
                Value="0" />
        <Setter Property="MinHeight"
                Value="0" />
        <!--<Setter Property="IsHoldingEnabled" Value="True" />-->
        <Setter Property="CornerRadius"
                Value="4" />
        <Setter Property="Margin"
                Value="8" />
        <Setter Property="UseSystemFocusVisuals"
                Value="{DynamicResource UseSystemFocusVisuals}" />
        <Setter Property="FocusVisualMargin"
                Value="-2" />
        <Setter Property="FocusVisualStyle"
                Value="{DynamicResource UWPFocusVisualStyle}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ui:GridViewItem">
                    <Border x:Name="ContentBorder"
                            Height="{Binding DisplayHeight}"
                            Width="{Binding DisplayWidth}"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="{TemplateBinding CornerRadius}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            Effect="{StaticResource CardDropShadow}">
                        <VisualStateManager.CustomVisualStateManager>
                            <ui:SimpleVisualStateManager />
                        </VisualStateManager.CustomVisualStateManager>

                        <Grid>
                            <ContentPresenter x:Name="ContentPresenter"
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                              Margin="{TemplateBinding Padding}"
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            <Border x:Name="BorderRectangle"
                                    IsHitTestVisible="False"
                                    BorderBrush="{DynamicResource SystemControlHighlightListAccentLowBrush}"
                                    BorderThickness="2"
                                    CornerRadius="4"
                                    Opacity="0" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <!-- Focused -->
                        <Trigger Property="ui:FocusVisualHelper.ShowFocusVisual"
                                 Value="True">
                            <Setter TargetName="BorderRectangle"
                                    Property="Visibility"
                                    Value="Collapsed" />
                        </Trigger>

                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding Selected}"
                                           Value="True" />

                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="ContentPresenter"
                                    Property="TextElement.Foreground"
                                    Value="{DynamicResource SystemControlHighlightAccentBrush}" />
                            <Setter TargetName="BorderRectangle"
                                    Property="Opacity"
                                    Value="1" />
                            <Setter TargetName="BorderRectangle"
                                    Property="BorderBrush"
                                    Value="{DynamicResource SystemControlHighlightAccentBrush}" />
                        </MultiDataTrigger>

                        <!-- PointerOver -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver"
                                           Value="True" />
                                <Condition Property="IsSelected"
                                           Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="BorderRectangle"
                                    Property="Opacity"
                                    Value="1" />
                            <Setter TargetName="BorderRectangle"
                                    Property="BorderBrush"
                                    Value="{DynamicResource SystemControlHighlightListLowBrush}" />
                            <Setter TargetName="ContentPresenter"
                                    Property="TextElement.Foreground"
                                    Value="{DynamicResource SystemControlForegroundBaseHighBrush}" />
                            <Setter Property="ui:FocusVisualHelper.FocusVisualSecondaryBrush"
                                    Value="{DynamicResource SystemControlHighlightListLowBrush}" />
                            <Setter Property="ui:FocusVisualHelper.FocusVisualSecondaryThickness"
                                    Value="2" />
                        </MultiTrigger>
                        <!-- Selected -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver"
                                           Value="False" />
                                <Condition Property="IsSelected"
                                           Value="True" />
                            </MultiTrigger.Conditions>

                            <!--<Setter TargetName="BorderRectangle"
                                        Property="Opacity"
                                        Value="1" />
                                <Setter TargetName="BorderRectangle"
                                        Property="Stroke"
                                        Value="{DynamicResource SystemControlHighlightAccentBrush}" />
                                <Setter TargetName="ContentPresenter"
                                        Property="TextElement.Foreground"
                                        Value="{DynamicResource SystemControlHighlightAccentBrush}" />
                                <Setter Property="ui:FocusVisualHelper.FocusVisualSecondaryBrush"
                                        Value="{DynamicResource SystemControlHighlightAccentBrush}" />
                                <Setter Property="ui:FocusVisualHelper.FocusVisualSecondaryThickness"
                                        Value="2" />-->

                        </MultiTrigger>
                        <!-- PointerOverSelected -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver"
                                           Value="True" />
                                <Condition Property="IsSelected"
                                           Value="True" />
                            </MultiTrigger.Conditions>

                            <Setter TargetName="BorderRectangle"
                                    Property="Opacity"
                                    Value="1" />
                            <Setter TargetName="BorderRectangle"
                                    Property="BorderBrush"
                                    Value="{DynamicResource SystemControlHighlightListAccentMediumBrush}" />
                            <Setter Property="ui:FocusVisualHelper.FocusVisualSecondaryBrush"
                                    Value="{DynamicResource SystemControlHighlightListAccentMediumBrush}" />
                            <Setter Property="ui:FocusVisualHelper.FocusVisualSecondaryThickness"
                                    Value="2" />

                        </MultiTrigger>
                        <!-- Disabled -->
                        <Trigger Property="IsEnabled"
                                 Value="False">
                            <Setter TargetName="ContentBorder"
                                    Property="Opacity"
                                    Value="{DynamicResource ListViewItemDisabledThemeOpacity}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    <Style x:Key="LayoutItemContainerStyle"
           TargetType="ui:GridViewItem">
        <Setter Property="Background"
                Value="{DynamicResource LayoutItemBackgroundBrush}" />
        <Setter Property="IsSelected"
                Value="{Binding IsApplied, Mode=OneWay}" />
        <Setter Property="AutomationProperties.Name"
                Value="{Binding Name}" />
        <Setter Property="KeyboardNavigation.TabNavigation"
                Value="Local" />
        <!--<Setter Property="IsHoldingEnabled" Value="True" />-->
        <Setter Property="CornerRadius"
                Value="4" />
        <Setter Property="Margin"
                Value="8" />
        <Setter Property="UseSystemFocusVisuals"
                Value="{DynamicResource UseSystemFocusVisuals}" />
        <Setter Property="FocusVisualMargin"
                Value="-2" />
        <Setter Property="FocusVisualStyle"
                Value="{DynamicResource UWPFocusVisualStyle}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ui:GridViewItem">
                    <Border x:Name="ContentBorder"
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CornerRadius="{TemplateBinding CornerRadius}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            Effect="{StaticResource CardDropShadow}">
                        <VisualStateManager.CustomVisualStateManager>
                            <ui:SimpleVisualStateManager />
                        </VisualStateManager.CustomVisualStateManager>

                        <Grid>
                            <ContentPresenter x:Name="ContentPresenter"
                                              HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                              Margin="{TemplateBinding Padding}"
                                              SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
                            <Border x:Name="BorderRectangle"
                                    IsHitTestVisible="False"
                                    BorderBrush="{DynamicResource SystemControlHighlightListAccentLowBrush}"
                                    BorderThickness="2"
                                    CornerRadius="4"
                                    Opacity="0" />
                        </Grid>
                    </Border>
                    <ControlTemplate.Triggers>
                        <!-- Focused -->
                        <Trigger Property="ui:FocusVisualHelper.ShowFocusVisual"
                                 Value="True">
                            <Setter TargetName="BorderRectangle"
                                    Property="Visibility"
                                    Value="Collapsed" />
                        </Trigger>

                        <MultiDataTrigger>
                            <MultiDataTrigger.Conditions>
                                <Condition Binding="{Binding IsApplied}"
                                           Value="True" />

                            </MultiDataTrigger.Conditions>
                            <Setter TargetName="ContentPresenter"
                                    Property="TextElement.Foreground"
                                    Value="{DynamicResource SystemControlHighlightAccentBrush}" />
                            <Setter TargetName="BorderRectangle"
                                    Property="Opacity"
                                    Value="1" />
                            <Setter TargetName="BorderRectangle"
                                    Property="BorderBrush"
                                    Value="{DynamicResource SystemControlHighlightAccentBrush}" />
                        </MultiDataTrigger>

                        <!-- PointerOver -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver"
                                           Value="True" />
                                <Condition Property="IsSelected"
                                           Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="BorderRectangle"
                                    Property="Opacity"
                                    Value="1" />
                            <Setter TargetName="BorderRectangle"
                                    Property="BorderBrush"
                                    Value="{DynamicResource SystemControlHighlightListLowBrush}" />
                            <Setter TargetName="ContentPresenter"
                                    Property="TextElement.Foreground"
                                    Value="{DynamicResource SystemControlForegroundBaseHighBrush}" />
                            <Setter Property="ui:FocusVisualHelper.FocusVisualSecondaryBrush"
                                    Value="{DynamicResource SystemControlHighlightListLowBrush}" />
                            <Setter Property="ui:FocusVisualHelper.FocusVisualSecondaryThickness"
                                    Value="2" />
                        </MultiTrigger>
                        <!-- Selected -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver"
                                           Value="False" />
                                <Condition Property="IsSelected"
                                           Value="True" />
                            </MultiTrigger.Conditions>

                            <!--<Setter TargetName="BorderRectangle"
                                        Property="Opacity"
                                        Value="1" />
                                <Setter TargetName="BorderRectangle"
                                        Property="Stroke"
                                        Value="{DynamicResource SystemControlHighlightAccentBrush}" />
                                <Setter TargetName="ContentPresenter"
                                        Property="TextElement.Foreground"
                                        Value="{DynamicResource SystemControlHighlightAccentBrush}" />
                                <Setter Property="ui:FocusVisualHelper.FocusVisualSecondaryBrush"
                                        Value="{DynamicResource SystemControlHighlightAccentBrush}" />
                                <Setter Property="ui:FocusVisualHelper.FocusVisualSecondaryThickness"
                                        Value="2" />-->

                        </MultiTrigger>
                        <!-- PointerOverSelected -->
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver"
                                           Value="True" />
                                <Condition Property="IsSelected"
                                           Value="True" />
                            </MultiTrigger.Conditions>

                            <Setter TargetName="BorderRectangle"
                                    Property="Opacity"
                                    Value="1" />
                            <Setter TargetName="BorderRectangle"
                                    Property="BorderBrush"
                                    Value="{DynamicResource SystemControlHighlightListAccentMediumBrush}" />
                            <Setter Property="ui:FocusVisualHelper.FocusVisualSecondaryBrush"
                                    Value="{DynamicResource SystemControlHighlightListAccentMediumBrush}" />
                            <Setter Property="ui:FocusVisualHelper.FocusVisualSecondaryThickness"
                                    Value="2" />

                        </MultiTrigger>
                        <!-- Disabled -->
                        <Trigger Property="IsEnabled"
                                 Value="False">
                            <Setter TargetName="ContentBorder"
                                    Property="Opacity"
                                    Value="{DynamicResource ListViewItemDisabledThemeOpacity}" />
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>