SPT-AKI-Installer/SPTInstaller/CustomControls/ProgressableTaskList.axaml

48 lines
2.2 KiB
XML

<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>
<ItemsControl Name="itemsControl" Items="{Binding Tasks, RelativeSource={RelativeSource AncestorType=UserControl}}"
Padding="5">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<cc:DistributedSpacePanel>
<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="20 3"
MinHeight="0"
Grid.RowSpan="6"
bh:SpanBehavior.Span="True"
/>
</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>
</UserControl>