<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:controls="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
             xmlns:sharedControls="clr-namespace:Artemis.UI.Shared.Controls"
             xmlns:attachedProperties="clr-namespace:Artemis.UI.Shared.AttachedProperties"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="Artemis.UI.Shared.Controls.DraggableNumberBox"
             Focusable="True">
    <UserControl.Styles>
        <Styles>
            <Style Selector="Panel#Container:not(:focus-within)">
                <Setter Property="Cursor" Value="{DynamicResource DragHorizontalCursor}" />
            </Style>

            <Style Selector="#Container:focus-within Rectangle#DragCollider">
                <Setter Property="IsHitTestVisible" Value="False" />
            </Style>
            <Style Selector="#Container:not(:focus-within) controls|NumberBox#NumberBox">
                <Setter Property="IsHitTestVisible" Value="False" />
            </Style>
        </Styles>
    </UserControl.Styles>

    <Panel Name="Container" Focusable="True">
        <controls:NumberBox Name="InnerNumberBox"
                            AcceptsExpression="True"
                            Focusable="True"
                            LargeChange="{CompiledBinding $parent[sharedControls:DraggableNumberBox].LargeChange}"
                            SmallChange="{CompiledBinding $parent[sharedControls:DraggableNumberBox].SmallChange}"
                            Minimum="{CompiledBinding $parent[sharedControls:DraggableNumberBox].Minimum}"
                            Maximum="{CompiledBinding $parent[sharedControls:DraggableNumberBox].Maximum}"
                            SimpleNumberFormat="{CompiledBinding $parent[sharedControls:DraggableNumberBox].SimpleNumberFormat}"
                            attachedProperties:NumberBoxAssist.PrefixText="{CompiledBinding $parent[sharedControls:DraggableNumberBox].Prefix}"
                            attachedProperties:NumberBoxAssist.SuffixText="{CompiledBinding $parent[sharedControls:DraggableNumberBox].Suffix}"
                            HorizontalAlignment="{CompiledBinding $parent[sharedControls:DraggableNumberBox].HorizontalAlignment}"/>
        <Rectangle Name="DragCollider" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" Fill="Transparent"></Rectangle>
    </Panel>

</UserControl>