Add project files.

This commit is contained in:
Daniel Clark
2022-11-01 15:26:08 +00:00
parent daa7b59f22
commit 7e4f880821
408 changed files with 16863 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
using System;
using System.Windows;
using System.Windows.Media.Animation;
namespace TheXamlGuy.UI.WPF;
public class AnimationHelper
{
public static ThicknessAnimation CreateAnimation(Thickness thickness = default, double milliseconds = 200)
{
return new(thickness, new Duration(TimeSpan.FromMilliseconds(milliseconds)))
{
EasingFunction = new PowerEase { EasingMode = EasingMode.EaseInOut }
};
}
public static DoubleAnimation CreateAnimation(double toValue, double milliseconds = 200)
{
return new(toValue, new Duration(TimeSpan.FromMilliseconds(milliseconds)))
{
EasingFunction = new PowerEase { EasingMode = EasingMode.EaseInOut }
};
}
}
+29
View File
@@ -0,0 +1,29 @@
using System.Windows;
using System.Windows.Data;
namespace TheXamlGuy.UI.WPF
{
public static class PropertyPathHelper
{
private static readonly Dummy dummy = new();
public static object GetValue(object args, string path)
{
Binding binding = new(path)
{
Mode = BindingMode.OneTime,
Source = args
};
BindingOperations.SetBinding(dummy, Dummy.ValueProperty, binding);
return dummy.GetValue(Dummy.ValueProperty);
}
private class Dummy : DependencyObject
{
public static readonly DependencyProperty ValueProperty =
DependencyProperty.Register("Value", typeof(object), typeof(Dummy),
new UIPropertyMetadata(null));
}
}
}