<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:po="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options">

    <!-- Theme brushes: these are the values PowerShell can swap later. -->
    <SolidColorBrush x:Key="AppBackgroundBrush" Color="#F0F0F0" po:Freeze="False"/>
    <SolidColorBrush x:Key="PanelBackgroundBrush" Color="#FFFFFF" po:Freeze="False"/>
    <SolidColorBrush x:Key="AppBarBackgroundBrush" Color="#2D2D30" po:Freeze="False"/>
    <SolidColorBrush x:Key="ControlBackgroundBrush" Color="#FFFFFF" po:Freeze="False"/>
    <SolidColorBrush x:Key="ControlForegroundBrush" Color="#111111" po:Freeze="False"/>
    <SolidColorBrush x:Key="ControlBorderBrush" Color="#555555" po:Freeze="False"/>
    <SolidColorBrush x:Key="MutedForegroundBrush" Color="#666666" po:Freeze="False"/>
    <SolidColorBrush x:Key="AccentBrush" Color="#007ACC" po:Freeze="False"/>
    <SolidColorBrush x:Key="AccentDarkBrush" Color="#005A9C" po:Freeze="False"/>
    <SolidColorBrush x:Key="ComboBoxItemHighlightBrush" Color="#003E6B" po:Freeze="False"/>
    <SolidColorBrush x:Key="ComboBoxItemHoverBrush" Color="#005A9C" po:Freeze="False"/>
    <SolidColorBrush x:Key="ComboBoxItemHighlightForegroundBrush" Color="#FFFFFF" po:Freeze="False"/>
    <SolidColorBrush x:Key="SwitchTrackOffBrush" Color="#ADB5BD" po:Freeze="False"/>
    <SolidColorBrush x:Key="SwitchTrackOffBorderBrush" Color="#87919B" po:Freeze="False"/>
    <SolidColorBrush x:Key="SwitchThumbBrush" Color="#FFFFFF" po:Freeze="False"/>

    <Style TargetType="{x:Type ComboBoxItem}">
        <Setter Property="Foreground" Value="{DynamicResource ControlForegroundBrush}"/>
        <Setter Property="Background" Value="{DynamicResource ControlBackgroundBrush}"/>
        <Setter Property="Padding" Value="6,3"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBoxItem}">
                    <Border x:Name="ItemBorder"
                            Background="{TemplateBinding Background}"
                            Padding="{TemplateBinding Padding}"
                            SnapsToDevicePixels="True">
                        <ContentPresenter VerticalAlignment="Center"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsHighlighted" Value="True">
                            <Setter TargetName="ItemBorder" Property="Background" Value="{DynamicResource ComboBoxItemHoverBrush}"/>
                            <Setter Property="Foreground" Value="{DynamicResource ComboBoxItemHighlightForegroundBrush}"/>
                        </Trigger>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="ItemBorder" Property="Background" Value="{DynamicResource ComboBoxItemHighlightBrush}"/>
                            <Setter Property="Foreground" Value="{DynamicResource ComboBoxItemHighlightForegroundBrush}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.55"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <Trigger Property="IsSelected" Value="True">
                <Setter Property="Background" Value="{DynamicResource ComboBoxItemHighlightBrush}"/>
                <Setter Property="Foreground" Value="{DynamicResource ComboBoxItemHighlightForegroundBrush}"/>
            </Trigger>
            <Trigger Property="IsMouseOver" Value="True">
                <Setter Property="Background" Value="{DynamicResource ComboBoxItemHoverBrush}"/>
                <Setter Property="Foreground" Value="{DynamicResource ComboBoxItemHighlightForegroundBrush}"/>
            </Trigger>
        </Style.Triggers>
    </Style>

    <Style TargetType="{x:Type ComboBox}">
        <Setter Property="Foreground" Value="{DynamicResource ControlForegroundBrush}"/>
        <Setter Property="Background" Value="{DynamicResource ControlBackgroundBrush}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource ControlBorderBrush}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ComboBox}">
                    <Grid SnapsToDevicePixels="True">
                        <ToggleButton x:Name="ToggleButton"
                                      Focusable="False"
                                      IsChecked="{Binding IsDropDownOpen, Mode=TwoWay, RelativeSource={RelativeSource TemplatedParent}}"
                                      ClickMode="Press"
                                      Background="{DynamicResource ControlBackgroundBrush}"
                                      BorderBrush="{DynamicResource ControlBorderBrush}"
                                      Foreground="{DynamicResource ControlForegroundBrush}">
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="24"/>
                                </Grid.ColumnDefinitions>
                                <ContentPresenter x:Name="ContentSite"
                                                  Margin="6,2,4,2"
                                                  HorizontalAlignment="Left"
                                                  VerticalAlignment="Center"
                                                  Content="{TemplateBinding SelectionBoxItem}"
                                                  ContentTemplate="{TemplateBinding SelectionBoxItemTemplate}"
                                                  ContentStringFormat="{TemplateBinding SelectionBoxItemStringFormat}"
                                                  IsHitTestVisible="False"/>
                                <TextBlock Grid.Column="1"
                                           Text="▼"
                                           HorizontalAlignment="Center"
                                           VerticalAlignment="Center"
                                           FontSize="9"
                                           Foreground="{DynamicResource ControlForegroundBrush}"/>
                            </Grid>
                        </ToggleButton>

                        <TextBox x:Name="PART_EditableTextBox"
                                 Margin="4,1,26,1"
                                 HorizontalAlignment="Stretch"
                                 VerticalAlignment="Center"
                                 Background="{DynamicResource ControlBackgroundBrush}"
                                 Foreground="{DynamicResource ControlForegroundBrush}"
                                 BorderBrush="{DynamicResource ControlBorderBrush}"
                                 BorderThickness="0"
                                 Visibility="Hidden"
                                 Focusable="True"
                                 IsReadOnly="{TemplateBinding IsReadOnly}"/>

                        <Popup x:Name="Popup"
                               Placement="Bottom"
                               IsOpen="{TemplateBinding IsDropDownOpen}"
                               AllowsTransparency="True"
                               Focusable="False"
                               PopupAnimation="Slide">
                            <Grid MinWidth="{TemplateBinding ActualWidth}"
                                  MaxHeight="{TemplateBinding MaxDropDownHeight}"
                                  Background="{DynamicResource ControlBackgroundBrush}">
                                <Border BorderBrush="{DynamicResource ControlBorderBrush}"
                                        BorderThickness="1"
                                        Background="{DynamicResource ControlBackgroundBrush}"/>
                                <ScrollViewer Margin="1" SnapsToDevicePixels="True">
                                    <ItemsPresenter KeyboardNavigation.DirectionalNavigation="Contained"/>
                                </ScrollViewer>
                            </Grid>
                        </Popup>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsEditable" Value="True">
                            <Setter TargetName="ContentSite" Property="Visibility" Value="Hidden"/>
                            <Setter TargetName="PART_EditableTextBox" Property="Visibility" Value="Visible"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.55"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type TextBlock}">
        <Setter Property="Foreground" Value="{DynamicResource ControlForegroundBrush}"/>
    </Style>

    <Style TargetType="{x:Type GroupBox}">
        <Setter Property="Foreground" Value="{DynamicResource ControlForegroundBrush}"/>
        <Setter Property="Background" Value="{DynamicResource PanelBackgroundBrush}"/>
    </Style>

    <Style TargetType="{x:Type TextBox}">
        <Setter Property="Foreground" Value="{DynamicResource ControlForegroundBrush}"/>
        <Setter Property="Background" Value="{DynamicResource ControlBackgroundBrush}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource ControlBorderBrush}"/>
    </Style>

    <Style TargetType="{x:Type CheckBox}">
        <Setter Property="Foreground" Value="{DynamicResource ControlForegroundBrush}"/>
    </Style>

    <Style TargetType="{x:Type RadioButton}">
        <Setter Property="Foreground" Value="{DynamicResource ControlForegroundBrush}"/>
    </Style>

    <Style TargetType="{x:Type ListView}">
        <Setter Property="Foreground" Value="{DynamicResource ControlForegroundBrush}"/>
        <Setter Property="Background" Value="{DynamicResource ControlBackgroundBrush}"/>
        <Setter Property="BorderBrush" Value="{DynamicResource ControlBorderBrush}"/>
    </Style>

    <Style TargetType="{x:Type TabControl}">
        <Setter Property="Foreground" Value="{DynamicResource ControlForegroundBrush}"/>
        <Setter Property="Background" Value="{DynamicResource PanelBackgroundBrush}"/>
    </Style>

    <Style TargetType="{x:Type TabItem}">
        <Setter Property="Foreground" Value="{DynamicResource ControlForegroundBrush}"/>
        <Setter Property="Background" Value="{DynamicResource PanelBackgroundBrush}"/>
        <Setter Property="Padding" Value="8,4"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type TabItem}">
                    <Border x:Name="TabBorder"
                            Background="{DynamicResource PanelBackgroundBrush}"
                            BorderBrush="{DynamicResource ControlBorderBrush}"
                            BorderThickness="1,1,1,0"
                            Padding="{TemplateBinding Padding}"
                            Margin="0,0,2,0">
                        <ContentPresenter x:Name="ContentSite"
                                          ContentSource="Header"
                                          HorizontalAlignment="Center"
                                          VerticalAlignment="Center"
                                          RecognizesAccessKey="True"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="TabBorder" Property="Background" Value="{DynamicResource ControlBackgroundBrush}"/>
                            <Setter Property="Foreground" Value="{DynamicResource ControlForegroundBrush}"/>
                            <Setter Property="Panel.ZIndex" Value="1"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter TargetName="TabBorder" Property="Background" Value="{DynamicResource ControlBackgroundBrush}"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.55"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="SwitchToggleStyle" TargetType="{x:Type ToggleButton}">
        <Setter Property="Foreground" Value="{DynamicResource ControlForegroundBrush}"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="MinHeight" Value="24"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToggleButton}">
                    <Grid SnapsToDevicePixels="True">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="44"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Border x:Name="Track"
                                Width="38" Height="20"
                                HorizontalAlignment="Left"
                                Background="{DynamicResource SwitchTrackOffBrush}"
                                BorderBrush="{DynamicResource SwitchTrackOffBorderBrush}"
                                BorderThickness="1"
                                CornerRadius="10"/>
                        <Ellipse x:Name="Thumb"
                                 Width="16" Height="16"
                                 HorizontalAlignment="Left"
                                 Margin="2,0,0,0"
                                 Fill="{DynamicResource SwitchThumbBrush}"
                                 Stroke="#DDE2E6"
                                 StrokeThickness="1"/>
                        <ContentPresenter Grid.Column="1"
                                          Margin="4,0,0,0"
                                          VerticalAlignment="Center"
                                          RecognizesAccessKey="True"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChecked" Value="True">
                            <Setter TargetName="Track" Property="Background" Value="{DynamicResource AccentBrush}"/>
                            <Setter TargetName="Track" Property="BorderBrush" Value="{DynamicResource AccentDarkBrush}"/>
                            <Setter TargetName="Thumb" Property="Margin" Value="20,0,0,0"/>
                        </Trigger>
                        <Trigger Property="IsEnabled" Value="False">
                            <Setter Property="Opacity" Value="0.55"/>
                            <Setter Property="Cursor" Value="Arrow"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
