<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
                    xmlns:s="https://github.com/canton7/Stylet"
                    xmlns:dataModel="clr-namespace:Artemis.UI.Shared">
    <Style x:Key="DataModelConditionButton" TargetType="{x:Type Button}" BasedOn="{StaticResource MaterialDesignFlatAccentBgButton}">
        <Setter Property="Margin" Value="3 0" />
        <Setter Property="Padding" Value="6 4" />
        <Setter Property="Height" Value="22" />
        <Setter Property="Foreground" Value="{DynamicResource PrimaryHueMidForegroundBrush}" />
        <Setter Property="FontSize" Value="12" />
    </Style>

    <Style x:Key="DataModelConditionButtonLeftClickMenu" TargetType="{x:Type Button}" BasedOn="{StaticResource DataModelConditionButton}">
        <Style.Triggers>
            <EventTrigger RoutedEvent="Click">
                <EventTrigger.Actions>
                    <BeginStoryboard>
                        <Storyboard>
                            <BooleanAnimationUsingKeyFrames Storyboard.TargetProperty="ContextMenu.IsOpen">
                                <DiscreteBooleanKeyFrame KeyTime="0:0:0" Value="True" />
                            </BooleanAnimationUsingKeyFrames>
                        </Storyboard>
                    </BeginStoryboard>
                </EventTrigger.Actions>
            </EventTrigger>
        </Style.Triggers>
    </Style>

    <ControlTemplate x:Key="DataModelSelectionTemplate">
        <StackPanel>
            <StackPanel.Resources>
                <DataTemplate DataType="{x:Type dataModel:DataModelPropertiesViewModel}">
                    <TextBlock Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" ToolTipService.ShowOnDisabled="True"/>
                </DataTemplate>
                <DataTemplate DataType="{x:Type dataModel:DataModelListViewModel}">
                    <StackPanel Orientation="Horizontal">
                        <materialDesign:PackIcon Kind="FormatListBulleted" VerticalAlignment="Center" Margin="0 0 5 0" />
                        <TextBlock Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" ToolTipService.ShowOnDisabled="True" VerticalAlignment="Center" />
                    </StackPanel>
                </DataTemplate>
                <DataTemplate DataType="{x:Type dataModel:DataModelEventViewModel}">
                    <StackPanel Orientation="Horizontal">
                        <materialDesign:PackIcon Kind="LightningBolt" VerticalAlignment="Center" Margin="0 0 5 0" />
                        <TextBlock Text="{Binding PropertyDescription.Name}" ToolTip="Trigger layer on event" ToolTipService.ShowOnDisabled="True" VerticalAlignment="Center" />
                    </StackPanel>
                </DataTemplate>
                <DataTemplate DataType="{x:Type dataModel:DataModelPropertyViewModel}">
                    <Grid>
                        <!-- Value description -->
                        <TextBlock Grid.Column="0" Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" />
                    </Grid>
                </DataTemplate>
            </StackPanel.Resources>
            <ContentPresenter Content="{Binding}" />
        </StackPanel>
    </ControlTemplate>

    <ControlTemplate x:Key="DataModelSelectionTemplateWithValues">
        <StackPanel>
            <StackPanel.Resources>
                <DataTemplate DataType="{x:Type dataModel:DataModelPropertiesViewModel}">
                    <Grid ToolTip="{Binding PropertyDescription.Description}" ToolTipService.ShowOnDisabled="True">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <!-- Value description -->
                        <TextBlock Grid.Column="0" Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" ToolTipService.ShowOnDisabled="True"/>

                        <!-- Value display -->
                        <TextBlock Grid.Column="1" Text="{Binding DisplayValue}" HorizontalAlignment="Right" FontFamily="Consolas" Margin="15 0.5 0 0"/>
                    </Grid>
                </DataTemplate>
                <DataTemplate DataType="{x:Type dataModel:DataModelListViewModel}">
                    <StackPanel Orientation="Horizontal">
                        <materialDesign:PackIcon Kind="FormatListBulleted" VerticalAlignment="Center" Margin="0 0 5 0" />
                        <TextBlock Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" ToolTipService.ShowOnDisabled="True" VerticalAlignment="Center"/>
                    </StackPanel>
                </DataTemplate>
                <DataTemplate DataType="{x:Type dataModel:DataModelEventViewModel}">
                    <StackPanel Orientation="Horizontal">
                        <materialDesign:PackIcon Kind="LightningBolt" VerticalAlignment="Center" Margin="0 0 5 0" />
                        <TextBlock Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" ToolTipService.ShowOnDisabled="True" VerticalAlignment="Center"/>
                    </StackPanel>
                </DataTemplate>
                <DataTemplate DataType="{x:Type dataModel:DataModelPropertyViewModel}">
                    <Grid ToolTip="{Binding PropertyDescription.Description}">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <!-- Value description -->
                        <TextBlock Grid.Column="0" Text="{Binding PropertyDescription.Name}" ToolTip="{Binding PropertyDescription.Description}" ToolTipService.ShowOnDisabled="True"/>

                        <!-- Value display -->
                        <StackPanel Grid.Column="1">
                            <ContentControl s:View.Model="{Binding DisplayViewModel}" FontFamily="Consolas" Margin="15 0.5 0 0"/>
                        </StackPanel>
                    </Grid>
                </DataTemplate>
            </StackPanel.Resources>
            <ContentPresenter Content="{Binding}" />
        </StackPanel>
    </ControlTemplate>
</ResourceDictionary>