mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-12 11:56:30 +00:00
Display conditions - Implemented most of static input
This commit is contained in:
1 parent
f944a675f1
commit
7af70e9ba4
14 files changed
+248
-30
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user