<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:cmds="clr-namespace:PixiEditor.AvaloniaUI.Models.Commands.XAML"
             xmlns:ui="clr-namespace:PixiEditor.Extensions.UI;assembly=PixiEditor.Extensions"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="PixiEditor.AvaloniaUI.Views.Main.Tools.Toolbar">
     <StackPanel
                Background="{DynamicResource ThemeBackgroundBrush1}"
                Orientation="Horizontal">
                <Button
                    Margin="12.5,0,0,0"
                    Width="24" Height="24"
                    Command="{cmds:Command PixiEditor.Undo.Undo}"
                    Classes="ImageButtonStyle"
                    ui:Translator.TooltipKey="UNDO">
                    <Button.Background>
                        <ImageBrush Source="/Images/Undo.png" />
                    </Button.Background>
                </Button>
                <Button
				Command="{cmds:Command PixiEditor.Undo.Redo}"
                Width="24" Height="24"
                Classes="ImageButtonStyle"
                Margin="0, 0, 5, 0"
				ui:Translator.TooltipKey="REDO">
                    <Button.Background>
                        <ImageBrush Source="/Images/Redo.png"/>
                    </Button.Background>
                </Button>
                <ToggleButton
				Width="30"
				BorderThickness="0"
				ui:Translator.TooltipKey="PEN_MODE"
				Focusable="False"
                IsChecked="{Binding StylusSubViewModel.IsPenModeEnabled}">
                    <ToggleButton.Styles>
                        <Style Selector="ToggleButton">
                            <Setter Property="Template">
                                <Setter.Value>
                                    <ControlTemplate TargetType="ToggleButton">
                                        <Border BorderBrush="{TemplateBinding BorderBrush}"
                                            Background="{TemplateBinding Background}" Focusable="False">
                                            <ContentPresenter HorizontalAlignment="Center"
                                              VerticalAlignment="Center" Focusable="False"/>
                                        </Border>
                                    </ControlTemplate>
                                </Setter.Value>
                            </Setter>
                            <!--TODO: Implement-->
                            <!--<Style.Triggers>
                                <Trigger Property="IsChecked" Value="False">
                                    <Setter Property="Background" Value="Transparent"/>
                                </Trigger>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Background" Value="#404040"/>
                                </Trigger>
                                <Trigger Property="IsChecked" Value="True">
                                    <Setter Property="Background" Value="#707070"/>
                                </Trigger>
                            </Style.Triggers>-->
                        </Style>
                    </ToggleButton.Styles>
                    <Image Height="20" Source="/Images/penMode.png"/>
                </ToggleButton>
                <Grid Margin="5,5,10,5" Background="{StaticResource BrighterAccentColor}" Width="5"/>
                <Label Classes="BaseLabel" FontSize="12"
                   VerticalAlignment="Center" ui:Translator.Key="{Binding ToolsSubViewModel.ActiveTool.DisplayName.Key}"
                   ui:Translator.TooltipLocalizedString="{Binding ToolsSubViewModel.ActiveTool.ActionDisplay}"
                   />
                <ItemsControl ItemsSource="{Binding ToolsSubViewModel.ActiveTool.Toolbar.Settings}">
                    <ItemsControl.ItemsPanel>
                        <ItemsPanelTemplate>
                            <StackPanel Orientation="Horizontal" Margin="10, 0, 0, 0" />
                        </ItemsPanelTemplate>
                    </ItemsControl.ItemsPanel>
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Margin="10,0,10,0">
                                <Label
                                IsVisible="{Binding HasLabel}" VerticalAlignment="Center"
                                Foreground="White" ui:Translator.Key="{Binding Label.Key}" />
                                <ContentControl VerticalAlignment="Center" Content="{Binding SettingControl}" />
                            </StackPanel>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </StackPanel>
</UserControl>
