Merge pull request #77 from PedroLamas/eventtriggerbehaviorruntime
Fixed #76: Properly check for Windows Runtime events in EventTriggerBehavior
This commit is contained in:
Коммит
393920f7d6
|
@ -185,7 +185,7 @@ namespace Microsoft.Xaml.Interactions.Core
|
|||
MethodInfo methodInfo = typeof(EventTriggerBehavior).GetTypeInfo().GetDeclaredMethod("OnEvent");
|
||||
this.eventHandler = methodInfo.CreateDelegate(info.EventHandlerType, this);
|
||||
|
||||
this.isWindowsRuntimeEvent = EventTriggerBehavior.IsWindowsRuntimeType(info.EventHandlerType);
|
||||
this.isWindowsRuntimeEvent = EventTriggerBehavior.IsWindowsRuntimeEvent(info);
|
||||
if (this.isWindowsRuntimeEvent)
|
||||
{
|
||||
this.addEventHandlerMethod = add => (EventRegistrationToken)info.AddMethod.Invoke(this.resolvedSource, new object[] { add });
|
||||
|
@ -288,6 +288,13 @@ namespace Microsoft.Xaml.Interactions.Core
|
|||
return (parent != null || (rootVisual != null && element == rootVisual));
|
||||
}
|
||||
|
||||
private static bool IsWindowsRuntimeEvent(EventInfo eventInfo)
|
||||
{
|
||||
return eventInfo != null &&
|
||||
EventTriggerBehavior.IsWindowsRuntimeType(eventInfo.EventHandlerType) &&
|
||||
EventTriggerBehavior.IsWindowsRuntimeType(eventInfo.DeclaringType);
|
||||
}
|
||||
|
||||
private static bool IsWindowsRuntimeType(Type type)
|
||||
{
|
||||
if (type != null)
|
||||
|
|
Загрузка…
Ссылка в новой задаче