<UserControl x:Class="PixiEditor.AvaloniaUI.Views.Input.SizeInput"
             x:ClassModifier="internal"
             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:ui="clr-namespace:PixiEditor.Extensions.UI;assembly=PixiEditor.Extensions"
             xmlns:input="clr-namespace:PixiEditor.AvaloniaUI.Views.Input"
             mc:Ignorable="d" Focusable="True"
             d:DesignHeight="30" Name="uc"
             FlowDirection="LeftToRight">
    <Border BorderThickness="1" CornerRadius="{DynamicResource ControlCornerRadius}"
            x:Name="border"
            Cursor="IBeam" PointerPressed="Border_MouseLeftButtonDown"
            PointerWheelChanged="Border_MouseWheel">
        <Border.Styles>
            <Style Selector="Border">
                <Setter Property="Background" Value="{DynamicResource ThemeControlLowBrush}"/>
                <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/>
            </Style>
            <Style Selector="Border:pointerover">
                <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderHighBrush}"/>
            </Style>
        </Border.Styles>
        <Grid>
            <Grid.ColumnDefinitions>
                <ColumnDefinition/>
                <ColumnDefinition Width="2"/>
                <ColumnDefinition Width="Auto"/>
            </Grid.ColumnDefinitions>
            <input:NumberInput IsEnabled="{Binding IsEnabled, ElementName=uc}" HorizontalContentAlignment="Right"
                     BorderThickness="0" Background="Transparent"
                     Foreground="{Binding Foreground, ElementName=uc}" Focusable="True"
                     Margin="0,0,5,0" VerticalAlignment="Center"
                     Decimals="0"
                     x:Name="input"
                     Value="{Binding Size, ElementName=uc, Mode=TwoWay}"
                     Min="1"
                     Max="{Binding MaxSize, ElementName=uc}"
                     d:Value="22"
                     FocusNext="{Binding FocusNext, ElementName=uc}"
                     SelectOnMouseClick="{Binding BehaveLikeSmallEmbeddedField, ElementName=uc}"
                     ConfirmOnEnter="{Binding BehaveLikeSmallEmbeddedField, ElementName=uc}"
                     Width="43"/>
            <Grid Grid.Column="1" Background="{Binding BorderBrush, ElementName=border}"
                  d:Background="{DynamicResource ThemeAccentBrush}"/>
            <TextBlock ui:Translator.Key="{Binding Unit, ElementName=uc}" 
                       TextAlignment="Right"
                       Grid.Column="2" Margin="5,0" VerticalAlignment="Center"
            />
        </Grid>
    </Border>
</UserControl>
