<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="../Brushes/DefaultColorTheme.xaml"/>
        <ResourceDictionary Source="../NamedStyles/RenumberValueButtonStyle.xaml"/>
    </ResourceDictionary.MergedDictionaries>
    <Style x:Key="RenumberValuesPopupBorder" TargetType="{x:Type Border}">
        <Setter Property="SnapsToDevicePixels" Value="True"></Setter>
        <Setter Property="Background" Value="{StaticResource ButtonNormalForegroundBrush}" />
        <Setter Property="BorderBrush" Value="{StaticResource ActiveElementBackgroundBrush}" />
        <Setter Property="BorderThickness" Value="3"/>
    </Style>

    <Style x:Key="RenumberValuesFocusVisual">
        <Setter Property="Control.Template">
            <Setter.Value>
                <ControlTemplate>
                    <Border>
                        <Rectangle SnapsToDevicePixels="true" Stroke="White" StrokeThickness="1" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="RenumberValues" TargetType="{x:Type ListBoxItem}">
        <Setter Property="SnapsToDevicePixels" Value="True"/>
        <Setter Property="HorizontalContentAlignment" Value="{Binding HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="VerticalContentAlignment" Value="{Binding VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
        <Setter Property="Background" Value="Transparent"/>
        <Setter Property="BorderBrush" Value="Transparent"/>
        <Setter Property="BorderThickness" Value="0"/>
        <Setter Property="FocusVisualStyle" Value="{StaticResource RenumberValuesFocusVisual}"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Button x:Name="renumberButton"
                            Content="{Binding DisplayName}" 
                            Command="{Binding Command}" 
                            CommandParameter="{Binding}"
                            Style="{StaticResource RenumberValueButton}"/>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsMouseOver" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="IsSelected" Value="True"></Setter>
                            <Setter Property="FocusManager.FocusedElement" Value="{Binding RelativeSource={RelativeSource Self}}" />
                            <Setter Property="Background" TargetName="renumberButton" Value="{StaticResource ActiveElementBackgroundBrush}"/>
                            <Setter Property="BorderBrush" TargetName="renumberButton" Value="{StaticResource ActiveElementBackgroundBrush}"/>
                            <Setter Property="Foreground" TargetName="renumberButton" Value="White"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="Selector.IsSelectionActive" Value="True"/>
                                <Condition Property="IsSelected" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" TargetName="renumberButton" Value="{StaticResource ActiveElementBackgroundBrush}"/>
                            <Setter Property="BorderBrush" TargetName="renumberButton" Value="{StaticResource ActiveElementBackgroundBrush}"/>
                            <Setter Property="Foreground" TargetName="renumberButton" Value="White"/>
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsKeyboardFocused" Value="False"/>
                                <Condition Property="IsMouseOver" Value="True"/>
                            </MultiTrigger.Conditions>
                            <Setter Property="Background" TargetName="renumberButton" Value="White"/>
                            <Setter Property="BorderBrush" TargetName="renumberButton" Value="White"/>
                            <Setter Property="Foreground" TargetName="renumberButton" Value="{StaticResource ActiveElementBackgroundBrush}"/>
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
                    
