support for .NET framework 3.5
Still have bugs
This commit is contained in:
1 parent
5878039e21
commit
7d6b491f25
704 files changed
+48273
-33
No files matched your search
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
|
||||
namespace HandyControl.Interactivity
|
||||
{
|
||||
public class RoutedEventTrigger : EventTriggerBase<DependencyObject>
|
||||
{
|
||||
public RoutedEvent RoutedEvent { get; set; }
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
var behavior = AssociatedObject as Behavior;
|
||||
var associatedElement = AssociatedObject as FrameworkElement;
|
||||
if (behavior != null) associatedElement = ((IAttachedObject)behavior).AssociatedObject as FrameworkElement;
|
||||
if (associatedElement == null) throw new ArgumentException();
|
||||
if (RoutedEvent != null) associatedElement.AddHandler(RoutedEvent, new RoutedEventHandler(OnRoutedEvent));
|
||||
}
|
||||
|
||||
private void OnRoutedEvent(object sender, RoutedEventArgs args)
|
||||
{
|
||||
OnEvent(args);
|
||||
}
|
||||
|
||||
protected override string GetEventName()
|
||||
{
|
||||
return RoutedEvent.Name;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user