<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:displayCondition="clr-namespace:Artemis.UI.Screens.ProfileEditor.DisplayCondition"
             mc:Ignorable="d" d:DesignWidth="200" d:DesignHeight="650"
             x:Class="Artemis.UI.Screens.ProfileEditor.DisplayCondition.DisplayConditionScriptView"
             x:DataType="displayCondition:DisplayConditionScriptViewModel">
    <UserControl.Styles>
        <Style Selector="ComboBox.condition-type /template/ ContentControl#ContentPresenter">
            <Setter Property="ContentTemplate">
                <Setter.Value>
                    <DataTemplate DataType="{x:Type displayCondition:ConditionTypeViewModel}">
                        <TextBlock Text="{CompiledBinding Name}" VerticalAlignment="Center" />
                    </DataTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Styles>
    <ScrollViewer>
        <Grid RowDefinitions="Auto,Auto,*">
            <TextBlock Grid.Row="0" Margin="0 5">Activation type</TextBlock>
            <ComboBox Name="ConditionType"
                      Grid.Row="1"
                      Classes="condition-type"
                      PlaceholderText="Select an activation type"
                      ItemsSource="{CompiledBinding ConditionTypeViewModels}"
                      IsEnabled="{CompiledBinding ProfileElement, Converter={x:Static ObjectConverters.IsNotNull}}"
                      SelectedItem="{CompiledBinding SelectedConditionTypeViewModel}"
                      HorizontalAlignment="Stretch">
                <ComboBox.ItemTemplate>
                    <DataTemplate DataType="{x:Type displayCondition:ConditionTypeViewModel}">
                        <StackPanel Spacing="5">
                            <TextBlock Text="{CompiledBinding Name}" TextWrapping="Wrap" MaxWidth="350" />
                            <TextBlock Text="{CompiledBinding Description}" Foreground="{DynamicResource TextFillColorSecondaryBrush}" TextWrapping="Wrap" MaxWidth="350" />
                        </StackPanel>
                    </DataTemplate>
                </ComboBox.ItemTemplate>
            </ComboBox>
            <ContentControl Grid.Row="2" Content="{CompiledBinding ConditionViewModel}" />
        </Grid>
    </ScrollViewer>
</UserControl>