<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:cc="using:SPTInstaller.CustomControls"
			 xmlns:bh="using:SPTInstaller.Behaviors"
			 xmlns:convt="using:SPTInstaller.Converters"
             mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
             x:Class="SPTInstaller.CustomControls.ProgressableTaskList"
			 >
	<UserControl.Resources>
		<convt:InvertedProgressConverter x:Key="invtProgressConvt"/>
	</UserControl.Resources>

    <Grid>
        <ProgressBar Orientation="Vertical"
                     Value="{Binding TaskProgress, RelativeSource={RelativeSource AncestorType=UserControl}, Converter={StaticResource ResourceKey=invtProgressConvt}}"
                     Background="{Binding CompletedColor, RelativeSource={RelativeSource AncestorType=UserControl}}"
                     Foreground="{Binding PendingColor, RelativeSource={RelativeSource AncestorType=UserControl}}"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Stretch"
                     Margin="25 20"
				     />
        <ItemsControl Name="itemsControl" ItemsSource="{Binding Tasks, RelativeSource={RelativeSource AncestorType=UserControl}}"
				  Padding="5">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <cc:DistributedSpacePanel/>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
            <ItemsControl.ItemTemplate>
                <DataTemplate>
                    <cc:ProgressableTaskItem TaskId="{Binding Id}"
                                             TaskName="{Binding Name}"
                                             IsRunning="{Binding IsRunning}"
                                             IsCompleted="{Binding IsCompleted}"
                                             PendingColor="{Binding PendingColor, RelativeSource={RelativeSource AncestorType=UserControl}}"
                                             RunningColor="{Binding RunningColor, RelativeSource={RelativeSource AncestorType=UserControl}}"
                                             CompletedColor="{Binding CompletedColor, RelativeSource={RelativeSource AncestorType=UserControl}}"
										 />
                </DataTemplate>
            </ItemsControl.ItemTemplate>
        </ItemsControl>
    </Grid>
</UserControl>