TopProgressView made bindable

This commit is contained in:
Justin Swanson 2019-11-08 22:21:33 -06:00
parent c18533e311
commit e17c8788a0
3 changed files with 70 additions and 31 deletions

View File

@ -190,7 +190,32 @@
</Grid> </Grid>
</Grid> </Grid>
<!-- Comes after slideshow control, so that any effects/overlap goes on top --> <!-- Comes after slideshow control, so that any effects/overlap goes on top -->
<local:TopProgressView Grid.Row="0" Grid.RowSpan="2" /> <local:TopProgressView
Title="{Binding ModListName}"
Grid.Row="0"
Grid.RowSpan="2"
ProgressPercent="{Binding ProgressPercent}"
StatePrefixTitle="{Binding ProgressTitle}">
<!-- Readd when Pause/Stop implementations added -->
<!--<Button Grid.Column="2"
ToolTip="Pause Installation"
Margin="0,0,0,5"
Width="50"
Visibility="{Binding InstallingMode, Converter={StaticResource bool2VisibilityConverter}}">
<icon:PackIconMaterial
Kind="Pause" />
</Button>
<Button Grid.Column="3"
ToolTip="Stop Installation"
Margin="0,0,0,5"
Width="50"
Visibility="{Binding InstallingMode, Converter={StaticResource bool2VisibilityConverter}}" >
<icon:PackIconFontAwesome
Width="25"
Height="25"
Kind="TimesCircleSolid" />
</Button>-->
</local:TopProgressView>
<!-- Bottom Area --> <!-- Bottom Area -->
<Grid <Grid
Grid.Row="2" Grid.Row="2"

View File

@ -20,7 +20,8 @@
Height="25" Height="25"
Margin="6,0" Margin="6,0"
VerticalAlignment="Top" VerticalAlignment="Top"
IsHitTestVisible="False"> IsHitTestVisible="False"
Visibility="{Binding OverhangShadow, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Converter={StaticResource bool2VisibilityConverter}}">
<Rectangle.Fill> <Rectangle.Fill>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0" Color="#AA000000" /> <GradientStop Offset="0" Color="#AA000000" />
@ -40,7 +41,7 @@
BorderBrush="Transparent" BorderBrush="Transparent"
Foreground="{StaticResource PrimaryVariantBrush}" Foreground="{StaticResource PrimaryVariantBrush}"
Maximum="1" Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}"> Value="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}">
<mahapps:MetroProgressBar.Effect> <mahapps:MetroProgressBar.Effect>
<BlurEffect Radius="25" /> <BlurEffect Radius="25" />
</mahapps:MetroProgressBar.Effect> </mahapps:MetroProgressBar.Effect>
@ -56,7 +57,7 @@
BorderBrush="Transparent" BorderBrush="Transparent"
Foreground="{StaticResource PrimaryBrush}" Foreground="{StaticResource PrimaryBrush}"
Maximum="1" Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}"> Value="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}">
<mahapps:MetroProgressBar.Effect> <mahapps:MetroProgressBar.Effect>
<BlurEffect Radius="20" /> <BlurEffect Radius="20" />
</mahapps:MetroProgressBar.Effect> </mahapps:MetroProgressBar.Effect>
@ -66,7 +67,6 @@
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" /> <ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<mahapps:MetroProgressBar <mahapps:MetroProgressBar
Grid.Column="0" Grid.Column="0"
@ -75,7 +75,7 @@
BorderThickness="0" BorderThickness="0"
Foreground="Transparent" Foreground="Transparent"
Maximum="1" Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}" /> Value="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
<mahapps:MetroProgressBar <mahapps:MetroProgressBar
Grid.Column="0" Grid.Column="0"
Grid.ColumnSpan="4" Grid.ColumnSpan="4"
@ -83,8 +83,8 @@
BorderThickness="0" BorderThickness="0"
Foreground="{StaticResource PrimaryVariantBrush}" Foreground="{StaticResource PrimaryVariantBrush}"
Maximum="1" Maximum="1"
Opacity="{Binding ProgressPercent, Mode=OneWay}" Opacity="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
Value="{Binding ProgressPercent, Mode=OneWay}" /> Value="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
<TextBlock <TextBlock
Grid.Column="0" Grid.Column="0"
Width="90" Width="90"
@ -92,7 +92,7 @@
VerticalAlignment="Bottom" VerticalAlignment="Bottom"
FontFamily="Lucida Sans" FontFamily="Lucida Sans"
FontWeight="Black" FontWeight="Black"
Text="{Binding ProgressTitle}" Text="{Binding StatePrefixTitle, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
TextAlignment="Right" /> TextAlignment="Right" />
<TextBlock <TextBlock
Grid.Column="1" Grid.Column="1"
@ -101,26 +101,8 @@
FontFamily="Lucida Sans" FontFamily="Lucida Sans"
FontSize="25" FontSize="25"
FontWeight="Black" FontWeight="Black"
Text="{Binding ModListName}" /> Text="{Binding Title, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
<!-- Readd when Pause/Stop implementations added --> <ContentControl Grid.Column="2" />
<!--<Button Grid.Column="2"
ToolTip="Pause Installation"
Margin="0,0,0,5"
Width="50"
Visibility="{Binding InstallingMode, Converter={StaticResource bool2VisibilityConverter}}">
<icon:PackIconMaterial
Kind="Pause" />
</Button>
<Button Grid.Column="3"
ToolTip="Stop Installation"
Margin="0,0,0,5"
Width="50"
Visibility="{Binding InstallingMode, Converter={StaticResource bool2VisibilityConverter}}" >
<icon:PackIconFontAwesome
Width="25"
Height="25"
Kind="TimesCircleSolid" />
</Button>-->
</Grid> </Grid>
<mahapps:MetroProgressBar <mahapps:MetroProgressBar
x:Name="BottomProgressBar" x:Name="BottomProgressBar"
@ -132,7 +114,7 @@
BorderBrush="Transparent" BorderBrush="Transparent"
Foreground="{StaticResource PrimaryBrush}" Foreground="{StaticResource PrimaryBrush}"
Maximum="1" Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}" /> Value="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
<mahapps:MetroProgressBar <mahapps:MetroProgressBar
x:Name="BottomProgressBarHighlight" x:Name="BottomProgressBarHighlight"
Grid.Row="1" Grid.Row="1"
@ -142,7 +124,7 @@
Background="Transparent" Background="Transparent"
BorderBrush="Transparent" BorderBrush="Transparent"
Maximum="1" Maximum="1"
Value="{Binding ProgressPercent, Mode=OneWay}"> Value="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}">
<mahapps:MetroProgressBar.Foreground> <mahapps:MetroProgressBar.Foreground>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0" Color="#CCFFFFFF" /> <GradientStop Offset="0" Color="#CCFFFFFF" />

View File

@ -20,6 +20,38 @@ namespace Wabbajack
/// </summary> /// </summary>
public partial class TopProgressView : UserControl public partial class TopProgressView : UserControl
{ {
public double ProgressPercent
{
get => (double)GetValue(ProgressPercentProperty);
set => SetValue(ProgressPercentProperty, value);
}
public static readonly DependencyProperty ProgressPercentProperty = DependencyProperty.Register(nameof(ProgressPercent), typeof(double), typeof(TopProgressView),
new FrameworkPropertyMetadata(default(double)));
public string Title
{
get => (string)GetValue(TitleProperty);
set => SetValue(TitleProperty, value);
}
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register(nameof(Title), typeof(string), typeof(TopProgressView),
new FrameworkPropertyMetadata(default(string)));
public string StatePrefixTitle
{
get => (string)GetValue(StatePrefixTitleProperty);
set => SetValue(StatePrefixTitleProperty, value);
}
public static readonly DependencyProperty StatePrefixTitleProperty = DependencyProperty.Register(nameof(StatePrefixTitle), typeof(string), typeof(TopProgressView),
new FrameworkPropertyMetadata(default(string)));
public bool OverhangShadow
{
get => (bool)GetValue(OverhangShadowProperty);
set => SetValue(OverhangShadowProperty, value);
}
public static readonly DependencyProperty OverhangShadowProperty = DependencyProperty.Register(nameof(OverhangShadow), typeof(bool), typeof(TopProgressView),
new FrameworkPropertyMetadata(true));
public TopProgressView() public TopProgressView()
{ {
InitializeComponent(); InitializeComponent();