mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Refactored AttentionBorder to a ContentControl
Looks like it's the proper way to do it anyway. https://stackoverflow.com/questions/751325/how-to-create-a-wpf-usercontrol-with-named-content UserControls are really just for super end-use
This commit is contained in:
parent
d788a3ae95
commit
7ad46c65cc
@ -12,6 +12,7 @@
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
|
||||
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
|
||||
<ResourceDictionary Source="Themes\Styles.xaml" />
|
||||
<ResourceDictionary Source="Themes\CustomControls.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Application.Resources>
|
||||
|
118
Wabbajack/Themes/CustomControls.xaml
Normal file
118
Wabbajack/Themes/CustomControls.xaml
Normal file
@ -0,0 +1,118 @@
|
||||
<ResourceDictionary
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:local="clr-namespace:Wabbajack">
|
||||
<Style TargetType="local:AttentionBorder">
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="local:AttentionBorder">
|
||||
<Border BorderThickness="1">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="Background" Value="{StaticResource WindowBackgroundBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource DarkerSecondaryBrush}" />
|
||||
<Style.Triggers>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsVisible, RelativeSource={RelativeSource Self}}" Value="True" />
|
||||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="False" />
|
||||
<Condition Binding="{Binding Failure, RelativeSource={RelativeSource AncestorType={x:Type local:AttentionBorder}}}" Value="False" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<MultiDataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
AutoReverse="True"
|
||||
RepeatBehavior="Forever"
|
||||
Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
|
||||
To="{StaticResource Secondary}"
|
||||
Duration="0:0:1.5" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
AutoReverse="True"
|
||||
RepeatBehavior="Forever"
|
||||
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
||||
To="{StaticResource SecondaryBackground}"
|
||||
Duration="0:0:1.5" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiDataTrigger.EnterActions>
|
||||
<MultiDataTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
|
||||
To="{StaticResource DarkerSecondary}"
|
||||
Duration="0:0:0.1" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
||||
To="{StaticResource WindowBackgroundColor}"
|
||||
Duration="0:0:0.1" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiDataTrigger.ExitActions>
|
||||
</MultiDataTrigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsVisible, RelativeSource={RelativeSource Self}}" Value="True" />
|
||||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="False" />
|
||||
<Condition Binding="{Binding Failure, RelativeSource={RelativeSource AncestorType={x:Type local:AttentionBorder}}}" Value="True" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<MultiDataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
AutoReverse="True"
|
||||
RepeatBehavior="Forever"
|
||||
Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
|
||||
To="#ff0026"
|
||||
Duration="0:0:1.5" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
AutoReverse="True"
|
||||
RepeatBehavior="Forever"
|
||||
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
||||
To="#540914"
|
||||
Duration="0:0:1.5" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiDataTrigger.EnterActions>
|
||||
<MultiDataTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
|
||||
To="#700d1c"
|
||||
Duration="0:0:0.1" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
||||
To="#1c0307"
|
||||
Duration="0:0:0.1" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiDataTrigger.ExitActions>
|
||||
</MultiDataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<ContentPresenter Content="{TemplateBinding Content}" />
|
||||
</Border>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</ResourceDictionary>
|
@ -20,14 +20,6 @@ namespace Wabbajack
|
||||
/// </summary>
|
||||
public partial class AttentionBorder : UserControl
|
||||
{
|
||||
public object DisplayContent
|
||||
{
|
||||
get => (object)GetValue(DisplayContentProperty);
|
||||
set => SetValue(DisplayContentProperty, value);
|
||||
}
|
||||
public static readonly DependencyProperty DisplayContentProperty = DependencyProperty.Register(nameof(DisplayContent), typeof(object), typeof(AttentionBorder),
|
||||
new FrameworkPropertyMetadata(default(object)));
|
||||
|
||||
public bool Failure
|
||||
{
|
||||
get => (bool)GetValue(FailureProperty);
|
||||
@ -35,10 +27,5 @@ namespace Wabbajack
|
||||
}
|
||||
public static readonly DependencyProperty FailureProperty = DependencyProperty.Register(nameof(Failure), typeof(bool), typeof(AttentionBorder),
|
||||
new FrameworkPropertyMetadata(default(bool)));
|
||||
|
||||
public AttentionBorder()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
<UserControl
|
||||
x:Class="Wabbajack.AttentionBorder"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:Wabbajack"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
d:DesignHeight="450"
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<Border BorderThickness="1">
|
||||
<Border.Style>
|
||||
<Style TargetType="Border">
|
||||
<Setter Property="Background" Value="{StaticResource WindowBackgroundBrush}" />
|
||||
<Setter Property="BorderBrush" Value="{StaticResource DarkerSecondaryBrush}" />
|
||||
<Style.Triggers>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsVisible, RelativeSource={RelativeSource Self}}" Value="True" />
|
||||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="False" />
|
||||
<Condition Binding="{Binding Failure, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" Value="False" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<MultiDataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
AutoReverse="True"
|
||||
RepeatBehavior="Forever"
|
||||
Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
|
||||
To="{StaticResource Secondary}"
|
||||
Duration="0:0:1.5" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
AutoReverse="True"
|
||||
RepeatBehavior="Forever"
|
||||
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
||||
To="{StaticResource SecondaryBackground}"
|
||||
Duration="0:0:1.5" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiDataTrigger.EnterActions>
|
||||
<MultiDataTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
|
||||
To="{StaticResource DarkerSecondary}"
|
||||
Duration="0:0:0.1" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
||||
To="{StaticResource WindowBackgroundColor}"
|
||||
Duration="0:0:0.1" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiDataTrigger.ExitActions>
|
||||
</MultiDataTrigger>
|
||||
<MultiDataTrigger>
|
||||
<MultiDataTrigger.Conditions>
|
||||
<Condition Binding="{Binding IsVisible, RelativeSource={RelativeSource Self}}" Value="True" />
|
||||
<Condition Binding="{Binding IsMouseOver, RelativeSource={RelativeSource Self}}" Value="False" />
|
||||
<Condition Binding="{Binding Failure, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" Value="True" />
|
||||
</MultiDataTrigger.Conditions>
|
||||
<MultiDataTrigger.EnterActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
AutoReverse="True"
|
||||
RepeatBehavior="Forever"
|
||||
Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
|
||||
To="#ff0026"
|
||||
Duration="0:0:1.5" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
AutoReverse="True"
|
||||
RepeatBehavior="Forever"
|
||||
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
||||
To="#540914"
|
||||
Duration="0:0:1.5" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiDataTrigger.EnterActions>
|
||||
<MultiDataTrigger.ExitActions>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)"
|
||||
To="#700d1c"
|
||||
Duration="0:0:0.1" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<ColorAnimation
|
||||
Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)"
|
||||
To="#1c0307"
|
||||
Duration="0:0:0.1" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</MultiDataTrigger.ExitActions>
|
||||
</MultiDataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</Border.Style>
|
||||
<ContentPresenter Content="{Binding DisplayContent, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}" />
|
||||
</Border>
|
||||
</UserControl>
|
@ -10,7 +10,6 @@
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<local:AttentionBorder ClipToBounds="True" Failure="{Binding Completed.Failed}">
|
||||
<local:AttentionBorder.DisplayContent>
|
||||
<Grid Margin="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
@ -145,6 +144,5 @@
|
||||
Text="Close" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</local:AttentionBorder.DisplayContent>
|
||||
</local:AttentionBorder>
|
||||
</UserControl>
|
||||
|
@ -301,11 +301,9 @@
|
||||
Grid.Column="2"
|
||||
ViewModel="{Binding}" />
|
||||
<local:AttentionBorder x:Name="UserInterventionsControl" Grid.Column="2">
|
||||
<local:AttentionBorder.DisplayContent>
|
||||
<Grid>
|
||||
<local:ConfirmationInterventionView DataContext="{Binding ActiveGlobalUserIntervention}" Visibility="{Binding ActiveGlobalUserIntervention, Converter={StaticResource IsTypeVisibilityConverter}, ConverterParameter={x:Type common:ConfirmationIntervention}}" />
|
||||
</Grid>
|
||||
</local:AttentionBorder.DisplayContent>
|
||||
</local:AttentionBorder>
|
||||
<local:CompilationCompleteView x:Name="CompilationComplete" Grid.Column="2" />
|
||||
</Grid>
|
||||
|
@ -10,7 +10,6 @@
|
||||
d:DesignWidth="800"
|
||||
mc:Ignorable="d">
|
||||
<local:AttentionBorder ClipToBounds="True" Failure="{Binding Completed.Failed}">
|
||||
<local:AttentionBorder.DisplayContent>
|
||||
<Grid Margin="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
@ -150,6 +149,5 @@
|
||||
Text="Close" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</local:AttentionBorder.DisplayContent>
|
||||
</local:AttentionBorder>
|
||||
</UserControl>
|
||||
|
@ -430,12 +430,10 @@
|
||||
ViewModel="{Binding}"
|
||||
Visibility="{Binding ActiveGlobalUserIntervention, Converter={StaticResource IsNotNullVisibilityConverter}, ConverterParameter=False}" />
|
||||
<local:AttentionBorder Grid.Column="2" Visibility="{Binding ActiveGlobalUserIntervention, Converter={StaticResource IsNotNullVisibilityConverter}}">
|
||||
<local:AttentionBorder.DisplayContent>
|
||||
<Grid>
|
||||
<local:ConfirmationInterventionView DataContext="{Binding ActiveGlobalUserIntervention}" Visibility="{Binding ActiveGlobalUserIntervention, Converter={StaticResource IsTypeVisibilityConverter}, ConverterParameter={x:Type common:ConfirmationIntervention}}" />
|
||||
<local:ConfirmUpdateOfExistingInstallView Visibility="{Binding ActiveGlobalUserIntervention, Converter={StaticResource IsTypeVisibilityConverter}, ConverterParameter={x:Type lib:ConfirmUpdateOfExistingInstall}}" />
|
||||
</Grid>
|
||||
</local:AttentionBorder.DisplayContent>
|
||||
</local:AttentionBorder>
|
||||
<local:InstallationCompleteView Grid.Column="2" Visibility="{Binding Completed, Converter={StaticResource IsNotNullVisibilityConverter}, FallbackValue=Collapsed}" />
|
||||
</Grid>
|
||||
|
@ -174,6 +174,7 @@
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Extensions\DynamicDataExt.cs" />
|
||||
<Compile Include="View Models\Settings\AuthorFilesVM.cs" />
|
||||
<Compile Include="Views\Common\AttentionBorder.cs" />
|
||||
<Compile Include="Views\ModListTileView.xaml.cs">
|
||||
<DependentUpon>ModListTileView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@ -202,9 +203,6 @@
|
||||
<Compile Include="Views\Settings\SettingsView.xaml.cs">
|
||||
<DependentUpon>SettingsView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Views\Common\AttentionBorder.xaml.cs">
|
||||
<DependentUpon>AttentionBorder.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Converters\IsTypeVisibilityConverter.cs" />
|
||||
<Compile Include="Views\Common\UnderMaintenanceOverlay.xaml.cs">
|
||||
<DependentUpon>UnderMaintenanceOverlay.xaml</DependentUpon>
|
||||
@ -308,6 +306,10 @@
|
||||
<Compile Include="Views\WebBrowserView.xaml.cs">
|
||||
<DependentUpon>WebBrowserView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="Themes\CustomControls.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\ModListTileView.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
@ -329,10 +331,6 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\Common\AttentionBorder.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Views\Common\UnderMaintenanceOverlay.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
Loading…
Reference in New Issue
Block a user