From e17c8788a030a559fa81aedca22c93716bc5f62d Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Fri, 8 Nov 2019 22:21:33 -0600 Subject: [PATCH] TopProgressView made bindable --- Wabbajack/Views/InstallationView.xaml | 27 +++++++++++++++- Wabbajack/Views/TopProgressView.xaml | 42 +++++++------------------ Wabbajack/Views/TopProgressView.xaml.cs | 32 +++++++++++++++++++ 3 files changed, 70 insertions(+), 31 deletions(-) diff --git a/Wabbajack/Views/InstallationView.xaml b/Wabbajack/Views/InstallationView.xaml index b33fabd6..42597040 100644 --- a/Wabbajack/Views/InstallationView.xaml +++ b/Wabbajack/Views/InstallationView.xaml @@ -190,7 +190,32 @@ - + + + + + IsHitTestVisible="False" + Visibility="{Binding OverhangShadow, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}, Converter={StaticResource bool2VisibilityConverter}}"> @@ -40,7 +41,7 @@ BorderBrush="Transparent" Foreground="{StaticResource PrimaryVariantBrush}" Maximum="1" - Value="{Binding ProgressPercent, Mode=OneWay}"> + Value="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"> @@ -56,7 +57,7 @@ BorderBrush="Transparent" Foreground="{StaticResource PrimaryBrush}" Maximum="1" - Value="{Binding ProgressPercent, Mode=OneWay}"> + Value="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"> @@ -66,7 +67,6 @@ - + Value="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" /> + Opacity="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" + Value="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" /> - - + Text="{Binding Title, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" /> + + Value="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" /> + Value="{Binding ProgressPercent, Mode=OneWay, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"> diff --git a/Wabbajack/Views/TopProgressView.xaml.cs b/Wabbajack/Views/TopProgressView.xaml.cs index eccc86f8..908dc8bc 100644 --- a/Wabbajack/Views/TopProgressView.xaml.cs +++ b/Wabbajack/Views/TopProgressView.xaml.cs @@ -20,6 +20,38 @@ namespace Wabbajack /// 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() { InitializeComponent();