<ResourceDictionary xmlns="https://github.com/avaloniaui"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:nodes="clr-namespace:PixiEditor.AvaloniaUI.Views.Nodes"
                    xmlns:visuals="clr-namespace:PixiEditor.AvaloniaUI.Views.Visuals"
                    xmlns:ui="clr-namespace:PixiEditor.Extensions.UI;assembly=PixiEditor.Extensions">
    <ControlTheme TargetType="nodes:NodeView" x:Key="{x:Type nodes:NodeView}">
        <Setter Property="Background" Value="{DynamicResource ThemeControlMidBrush}" />
        <Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}" />
        <Setter Property="BorderThickness" Value="1" />
        <Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
        <Setter Property="Padding" Value="5" />
        <Setter Property="ClipToBounds" Value="False"/>
        <Setter Property="Template">
            <ControlTemplate>
                <Border Background="{TemplateBinding Background}"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        CornerRadius="{TemplateBinding CornerRadius}"
                        Margin="{TemplateBinding Margin}"
                        Name="RootBorder">
                    <Border.Effect>
                        <DropShadowEffect Opacity="0.5" BlurRadius="25"></DropShadowEffect>
                    </Border.Effect>
                    <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                                <RowDefinition Height="Auto" />
                            </Grid.RowDefinitions>
                            <Border Padding="{TemplateBinding Padding}" Grid.ColumnSpan="3" Grid.Row="0"
                                    CornerRadius="4.5, 4.5, 0 ,0"
                                    Background="{DynamicResource ThemeControlHighBrush}">
                                <TextBlock ui:Translator.Key="{TemplateBinding DisplayName}"
                                           FontWeight="Bold" />
                            </Border>
                            <Border Grid.Row="1" Background="{DynamicResource ThemeControlMidBrush}">
                                <StackPanel>
                                    <ItemsControl ItemsSource="{TemplateBinding Outputs}"
                                                  ClipToBounds="False">
                                        <ItemsControl.ItemContainerTheme>
                                            <ControlTheme TargetType="ContentPresenter">
                                                <Setter Property="DataContext" Value="." />
                                            </ControlTheme>
                                        </ItemsControl.ItemContainerTheme>
                                    </ItemsControl>
                                    <ItemsControl ItemsSource="{TemplateBinding Inputs}" ClipToBounds="False">
                                        <ItemsControl.ItemContainerTheme>
                                            <ControlTheme TargetType="ContentPresenter">
                                                <Setter Property="DataContext" Value="." />
                                            </ControlTheme>
                                        </ItemsControl.ItemContainerTheme>
                                    </ItemsControl>
                                </StackPanel>
                            </Border>
                            <Border CornerRadius="0, 0, 4.5, 4.5" Grid.Row="2" ClipToBounds="True">
                                <visuals:SurfaceControl Width="200" Height="200"
                                                        Surface="{TemplateBinding ResultPreview}"
                                                        RenderOptions.BitmapInterpolationMode="None">
                                    <visuals:SurfaceControl.Background>
                                        <ImageBrush Source="/Images/CheckerTile.png"
                                                    TileMode="Tile" DestinationRect="0, 0, 25, 25" />
                                    </visuals:SurfaceControl.Background>
                                </visuals:SurfaceControl>
                            </Border>
                        </Grid>
                    </Border>
            </ControlTemplate>
        </Setter>

        <Style Selector="^:selected /template/ Border#RootBorder">
            <Setter Property="BorderBrush" Value="{DynamicResource ThemeAccent2Brush}" />
            <Setter Property="BorderThickness" Value="1" />
        </Style>
    </ControlTheme>
</ResourceDictionary>