|
|
|
@ -153,6 +153,20 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
PointerOverElementProperty.Changed.AddClassHandler<TopLevel>((topLevel, e) => |
|
|
|
{ |
|
|
|
if (e.OldValue is InputElement oldInputElement) |
|
|
|
{ |
|
|
|
oldInputElement.PropertyChanged -= topLevel.PointerOverElementOnPropertyChanged; |
|
|
|
} |
|
|
|
|
|
|
|
if (e.NewValue is InputElement newInputElement) |
|
|
|
{ |
|
|
|
topLevel.PlatformImpl?.SetCursor(newInputElement.Cursor?.PlatformImpl); |
|
|
|
newInputElement.PropertyChanged += topLevel.PointerOverElementOnPropertyChanged; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
@ -215,11 +229,6 @@ namespace Avalonia.Controls |
|
|
|
ClientSize = impl.ClientSize; |
|
|
|
FrameSize = impl.FrameSize; |
|
|
|
|
|
|
|
this.GetObservable(PointerOverElementProperty) |
|
|
|
.Select( |
|
|
|
x => (x as InputElement)?.GetObservable(CursorProperty) ?? Observable.Empty<Cursor>()) |
|
|
|
.Switch().Subscribe(cursor => PlatformImpl?.SetCursor(cursor?.PlatformImpl)); |
|
|
|
|
|
|
|
if (((IStyleHost)this).StylingParent is IResourceHost applicationResources) |
|
|
|
{ |
|
|
|
_resourcesChangesSubscriber = new TargetWeakEventSubscriber<TopLevel, ResourcesChangedEventArgs>( |
|
|
|
@ -751,6 +760,14 @@ namespace Avalonia.Controls |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void PointerOverElementOnPropertyChanged(object? sender, AvaloniaPropertyChangedEventArgs e) |
|
|
|
{ |
|
|
|
if (e.Property == CursorProperty && sender is InputElement inputElement) |
|
|
|
{ |
|
|
|
PlatformImpl?.SetCursor(inputElement.Cursor?.PlatformImpl); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private void GlobalActualThemeVariantChanged(object? sender, EventArgs e) |
|
|
|
{ |
|
|
|
SetValue(ActualThemeVariantProperty, ((IThemeVariantHost)sender!).ActualThemeVariant, BindingPriority.Template); |
|
|
|
|