Browse Source
Merge pull request #2536 from AvaloniaUI/fixes/2315-addclasshandler-static
Fix usage of AddClassHandler
pull/2679/head
Steven Kirk
7 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with
4 additions and
3 deletions
-
src/Avalonia.Diagnostics/ViewModels/EventTreeNode.cs
-
src/Avalonia.Input/FocusManager.cs
|
|
|
@ -56,6 +56,7 @@ namespace Avalonia.Diagnostics.ViewModels |
|
|
|
{ |
|
|
|
if (IsEnabled.GetValueOrDefault() && !_isRegistered) |
|
|
|
{ |
|
|
|
// FIXME: This leaks event handlers.
|
|
|
|
_event.AddClassHandler(typeof(object), HandleEvent, (RoutingStrategies)7, handledEventsToo: true); |
|
|
|
_isRegistered = true; |
|
|
|
} |
|
|
|
|
|
|
|
@ -23,7 +23,7 @@ namespace Avalonia.Input |
|
|
|
/// <summary>
|
|
|
|
/// Initializes a new instance of the <see cref="FocusManager"/> class.
|
|
|
|
/// </summary>
|
|
|
|
public FocusManager() |
|
|
|
static FocusManager() |
|
|
|
{ |
|
|
|
InputElement.PointerPressedEvent.AddClassHandler( |
|
|
|
typeof(IInputElement), |
|
|
|
@ -174,7 +174,7 @@ namespace Avalonia.Input |
|
|
|
/// </summary>
|
|
|
|
/// <param name="sender">The event sender.</param>
|
|
|
|
/// <param name="e">The event args.</param>
|
|
|
|
private void OnPreviewPointerPressed(object sender, RoutedEventArgs e) |
|
|
|
private static void OnPreviewPointerPressed(object sender, RoutedEventArgs e) |
|
|
|
{ |
|
|
|
var ev = (PointerPressedEventArgs)e; |
|
|
|
|
|
|
|
@ -191,7 +191,7 @@ namespace Avalonia.Input |
|
|
|
|
|
|
|
if (element != null) |
|
|
|
{ |
|
|
|
Focus(element, NavigationMethod.Pointer, ev.InputModifiers); |
|
|
|
Instance?.Focus(element, NavigationMethod.Pointer, ev.InputModifiers); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|