<ResourceDictionary
    xmlns="https://github.com/avaloniaui"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:u="https://irihi.tech/ursa">
    <!--  Add Resources Here  -->
    <Design.PreviewWith>
        <StackPanel Margin="20">
            <TextBlock Text="Hello World" />
        </StackPanel>
    </Design.PreviewWith>
    <MenuFlyout x:Key="IPv4BoxMenuFlyout">
        <MenuItem
            x:Name="TextBoxContextFlyoutCutItem"
            Command="{Binding $parent[u:IPv4Box].Cut}"
            Header="Cut"
            InputGesture="{x:Static u:IPv4Box.CutKeyGesture}" />
        <MenuItem
            x:Name="TextBoxContextFlyoutCopyItem"
            Command="{Binding $parent[u:IPv4Box].Copy}"
            Header="Copy"
            InputGesture="{x:Static u:IPv4Box.CopyKeyGesture}" />
        <MenuItem
            x:Name="TextBoxContextFlyoutPasteItem"
            Command="{Binding $parent[u:IPv4Box].Paste}"
            Header="Paste"
            InputGesture="{x:Static u:IPv4Box.PasteKeyGesture}" />
        <MenuItem
            x:Name="TextBoxContextFlyoutClearItem"
            Command="{Binding $parent[u:IPv4Box].Clear}"
            Header="Clear" />
    </MenuFlyout>
    <ControlTheme x:Key="{x:Type u:IPv4Box}" TargetType="{x:Type u:IPv4Box}">
        <Setter Property="u:IPv4Box.Focusable" Value="True" />
        <Setter Property="u:IPv4Box.ShowLeadingZero" Value="True" />
        <Setter Property="u:IPv4Box.TextAlignment" Value="Center" />
        <Setter Property="u:IPv4Box.HorizontalAlignment" Value="Left" />
        <Setter Property="u:IPv4Box.CornerRadius" Value="{DynamicResource IPv4BoxCornerRadius}" />
        <Setter Property="u:IPv4Box.Background" Value="{DynamicResource IPv4BoxBackground}" />
        <Setter Property="u:IPv4Box.MinHeight" Value="{DynamicResource IPv4BoxDefaultMinHeight}" />
        <Setter Property="u:IPv4Box.BorderThickness" Value="{DynamicResource IPv4BoxBorderThickness}" />
        <Setter Property="u:IPv4Box.SelectionBrush" Value="{DynamicResource IPv4BoxSelectionBrush}" />
        <Setter Property="u:IPv4Box.SelectionForegroundBrush" Value="{DynamicResource IPv4BoxSelectionForeground}" />
        <Setter Property="u:IPv4Box.CaretBrush" Value="{DynamicResource IPv4BoxCaretBrush}" />
        <Setter Property="u:IPv4Box.ContextFlyout" Value="{DynamicResource IPv4BoxMenuFlyout}" />
        <Setter Property="u:IPv4Box.Template">
            <ControlTemplate TargetType="u:IPv4Box">
                <Border
                    Name="PART_Border"
                    Background="{TemplateBinding Background}"
                    BorderBrush="{TemplateBinding BorderBrush}"
                    BorderThickness="{TemplateBinding BorderThickness}"
                    CornerRadius="{TemplateBinding CornerRadius}">
                    <Grid Width="{TemplateBinding Width}" ColumnDefinitions="1*, Auto, 1*, Auto, 1*, Auto, 1*">
                        <TextPresenter
                            Name="{x:Static u:IPv4Box.PART_FirstTextPresenter}"
                            Grid.Column="0"
                            MinWidth="8"
                            VerticalAlignment="Center"
                            CaretBrush="{TemplateBinding CaretBrush}"
                            Cursor="IBeam"
                            SelectionBrush="{TemplateBinding SelectionBrush}"
                            SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
                            TextAlignment="{TemplateBinding TextAlignment}" />
                        <TextBlock
                            Grid.Column="1"
                            Margin="0,4"
                            VerticalAlignment="Center"
                            Focusable="False"
                            Text="." />
                        <TextPresenter
                            Name="{x:Static u:IPv4Box.PART_SecondTextPresenter}"
                            Grid.Column="2"
                            MinWidth="8"
                            VerticalAlignment="Center"
                            CaretBrush="{TemplateBinding CaretBrush}"
                            Cursor="IBeam"
                            SelectionBrush="{TemplateBinding SelectionBrush}"
                            SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
                            TextAlignment="{TemplateBinding TextAlignment}" />
                        <TextBlock
                            Grid.Column="3"
                            Margin="0,4"
                            VerticalAlignment="Center"
                            Text="." />
                        <TextPresenter
                            Name="{x:Static u:IPv4Box.PART_ThirdTextPresenter}"
                            Grid.Column="4"
                            MinWidth="8"
                            VerticalAlignment="Center"
                            CaretBrush="{TemplateBinding CaretBrush}"
                            Cursor="IBeam"
                            SelectionBrush="{TemplateBinding SelectionBrush}"
                            SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
                            TextAlignment="{TemplateBinding TextAlignment}" />
                        <TextBlock
                            Grid.Column="5"
                            Margin="0,4"
                            VerticalAlignment="Center"
                            Text="." />
                        <TextPresenter
                            Name="{x:Static u:IPv4Box.PART_FourthTextPresenter}"
                            Grid.Column="6"
                            MinWidth="8"
                            VerticalAlignment="Center"
                            CaretBrush="{TemplateBinding CaretBrush}"
                            Cursor="IBeam"
                            SelectionBrush="{TemplateBinding SelectionBrush}"
                            SelectionForegroundBrush="{TemplateBinding SelectionForegroundBrush}"
                            TextAlignment="{TemplateBinding TextAlignment}" />
                    </Grid>
                </Border>
            </ControlTemplate>
        </Setter>
        <Style Selector="^:pointerover /template/ Border#PART_Border">
            <Setter Property="Border.Background" Value="{DynamicResource IPv4BoxPointeroverBackground}" />
        </Style>
        <Style Selector="^:pressed /template/ Border#PART_Border">
            <Setter Property="Border.Background" Value="{DynamicResource IPv4BoxPressedBackground}" />
        </Style>
        <Style Selector="^:focus-within">
            <Setter Property="Border.BorderBrush" Value="{DynamicResource IPv4BoxFocusBorderBrush}" />
        </Style>
        <Style Selector="^:disabled">
            <Setter Property="Border.Background" Value="{DynamicResource IPv4BoxDisabledBackground}" />
        </Style>
    </ControlTheme>
</ResourceDictionary>
