<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:screens="clr-namespace:Artemis.VisualScripting.Nodes.Static.Screens"
             xmlns:skiaSharp="clr-namespace:SkiaSharp;assembly=SkiaSharp"
             xmlns:core="clr-namespace:Artemis.Core;assembly=Artemis.Core"
             xmlns:converters1="clr-namespace:Artemis.UI.Shared.Converters;assembly=Artemis.UI.Shared"
             xmlns:collections="clr-namespace:System.Collections;assembly=System.Runtime"
             xmlns:system="clr-namespace:System;assembly=System.Runtime"
             xmlns:converters="clr-namespace:Artemis.VisualScripting.Converters"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="Artemis.VisualScripting.Nodes.Static.Screens.DisplayValueNodeCustomView"
             x:DataType="screens:DisplayValueNodeCustomViewModel">
    <UserControl.Resources>
        <converters1:SKColorToStringConverter x:Key="SKColorToStringConverter" />
        <converters1:SKColorToColorConverter x:Key="SKColorToColorConverter" />
        <converters:JsonConverter x:Key="JsonConverter" />
    </UserControl.Resources>
    <ContentControl Content="{CompiledBinding CurrentValue}" VerticalContentAlignment="Center">
        <ContentControl.DataTemplates>
            <DataTemplate DataType="skiaSharp:SKColor">
                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
                    <TextBlock x:Name="HexDisplay"
                               Text="{CompiledBinding Converter={StaticResource SKColorToStringConverter}}"
                               VerticalAlignment="Center"
                               HorizontalAlignment="Stretch" 
                               FontFamily="Consolas"/>
                    <Border Margin="5 0 0 0"
                            VerticalAlignment="Bottom"
                            HorizontalAlignment="Right"
                            BorderThickness="1"
                            MinWidth="18"
                            MinHeight="18"
                            Background="{DynamicResource CheckerboardBrush}"
                            BorderBrush="{DynamicResource ColorPickerButtonOutline}"
                            CornerRadius="4"
                            ClipToBounds="True">
                        <Border CornerRadius="4">
                            <Border.Background>
                                <SolidColorBrush Color="{CompiledBinding Converter={StaticResource SKColorToColorConverter}}" />
                            </Border.Background>
                        </Border>
                    </Border>
                </StackPanel>
            </DataTemplate>
            <DataTemplate DataType="system:Object">
                <Border Classes="card-condensed" Margin="0,5,5,5 ">
                    <TextBlock Text="{CompiledBinding Converter={StaticResource JsonConverter}}" FontFamily="Consolas"/>    
                </Border>
            </DataTemplate>
        </ContentControl.DataTemplates>
    </ContentControl>
</UserControl>
