<UserControl x:Class="Artemis.UI.Screens.Settings.Tabs.Plugins.PluginSettingsTabView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:local="clr-namespace:Artemis.UI.Screens.Settings.Tabs.Plugins"
             xmlns:s="https://github.com/canton7/Stylet"
             xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
             mc:Ignorable="d"
             d:DesignHeight="450" d:DesignWidth="800"
             d:DataContext="{d:DesignInstance local:PluginSettingsTabViewModel}">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid Margin="0 15" Width="910">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="Auto" />
                <ColumnDefinition Width="200" />
                <ColumnDefinition Width="*" />
                <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock Grid.Column="0" TextWrapping="Wrap">
                The list below shows all loaded plugins. <LineBreak />
                If you're missing something, view your logs folder.
            </TextBlock>
            <materialDesign:PackIcon Grid.Column="1"
                                     Kind="Search"
                                     VerticalAlignment="Top"
                                     Margin="15 8 0 0" />
            <TextBox Grid.Column="2"
                     Style="{StaticResource MaterialDesignFilledTextBox}"
                     materialDesign:TextFieldAssist.HasClearButton="True"
                     materialDesign:HintAssist.Hint="Search plugin"
                     materialDesign:HintAssist.IsFloating="False"
                     VerticalAlignment="Top"
                     Margin="5 0"
                     Text="{Binding SearchPluginInput, Delay=300, UpdateSourceTrigger=PropertyChanged}" />

            <Button Grid.Column="3" Style="{DynamicResource MaterialDesignFlatButton}"
                    HorizontalAlignment="Right"
                    Command="{s:Action OpenUrl}"
                    CommandParameter="https://wiki.artemis-rgb.com/en/guides/user/plugins">
                <StackPanel Orientation="Horizontal">
                    <materialDesign:PackIcon Kind="OpenInBrowser" />
                    <TextBlock Margin="8 0 0 0" VerticalAlignment="Center">Get more plugins</TextBlock>
                </StackPanel>
            </Button>

            <Button Grid.Column="4"
                    HorizontalAlignment="Right"
                    Style="{StaticResource MaterialDesignRaisedButton}"
                    Command="{s:Action ImportPlugin}"
                    Margin="15 0">
                IMPORT PLUGIN
            </Button>
        </Grid>

        <ListBox Grid.Row="1"
                 ItemsSource="{Binding Items}"
                 VirtualizingPanel.ScrollUnit="Pixel"
                 HorizontalAlignment="Stretch"
                 HorizontalContentAlignment="Center"
                 Margin="15 0 15 15">
            <ListBox.ItemTemplate>
                <DataTemplate>
                    <ContentControl s:View.Model="{Binding IsAsync=True}" Margin="5" HorizontalAlignment="Center" IsTabStop="False" />
                </DataTemplate>
            </ListBox.ItemTemplate>
            <ListBox.ItemsPanel>
                <ItemsPanelTemplate>
                    <VirtualizingStackPanel />
                </ItemsPanelTemplate>
            </ListBox.ItemsPanel>

            <ListBox.ItemContainerStyle>
                <Style TargetType="{x:Type ListBoxItem}">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="{x:Type ListBoxItem}">
                                <ContentPresenter />
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </ListBox.ItemContainerStyle>
        </ListBox>
    </Grid>
</UserControl>