Display conditions - Implemented most of static input

This commit is contained in:
SpoinkyNL committed 2020-07-06 23:41:41 +02:00
1 parent f944a675f1
commit 7af70e9ba4
14 files changed
+248 -30

No files matched your search

+39
View File
@@ -0,0 +1,39 @@
using System.Windows;
using System.Windows.Input;
namespace Artemis.UI.Behaviors
{
public class MouseBehavior
{
public static readonly DependencyProperty MouseUpCommandProperty =
DependencyProperty.RegisterAttached("MouseUpCommand", typeof(ICommand),
typeof(MouseBehavior), new FrameworkPropertyMetadata(
MouseUpCommandChanged));
public static void SetMouseUpCommand(UIElement element, ICommand value)
{
element.SetValue(MouseUpCommandProperty, value);
}
public static ICommand GetMouseUpCommand(UIElement element)
{
return (ICommand) element.GetValue(MouseUpCommandProperty);
}
private static void MouseUpCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var element = (FrameworkElement) d;
element.MouseUp += element_MouseUp;
}
private static void element_MouseUp(object sender, MouseButtonEventArgs e)
{
var element = (FrameworkElement) sender;
var command = GetMouseUpCommand(element);
command.Execute(e);
}
}
}