|
|
|
@ -50,6 +50,7 @@ namespace Avalonia.Controls |
|
|
|
private readonly IAccessKeyHandler _accessKeyHandler; |
|
|
|
private readonly IKeyboardNavigationHandler _keyboardNavigationHandler; |
|
|
|
private readonly IPlatformRenderInterface _renderInterface; |
|
|
|
private readonly IGlobalStyles _globalStyles; |
|
|
|
private Size _clientSize; |
|
|
|
private ILayoutManager _layoutManager; |
|
|
|
|
|
|
|
@ -94,6 +95,7 @@ namespace Avalonia.Controls |
|
|
|
_inputManager = TryGetService<IInputManager>(dependencyResolver); |
|
|
|
_keyboardNavigationHandler = TryGetService<IKeyboardNavigationHandler>(dependencyResolver); |
|
|
|
_renderInterface = TryGetService<IPlatformRenderInterface>(dependencyResolver); |
|
|
|
_globalStyles = TryGetService<IGlobalStyles>(dependencyResolver); |
|
|
|
|
|
|
|
Renderer = impl.CreateRenderer(this); |
|
|
|
|
|
|
|
@ -112,6 +114,13 @@ namespace Avalonia.Controls |
|
|
|
|
|
|
|
_keyboardNavigationHandler?.SetOwner(this); |
|
|
|
_accessKeyHandler?.SetOwner(this); |
|
|
|
|
|
|
|
if (_globalStyles is object) |
|
|
|
{ |
|
|
|
_globalStyles.GlobalStylesAdded += ((IStyleHost)this).StylesAdded; |
|
|
|
_globalStyles.GlobalStylesRemoved += ((IStyleHost)this).StylesRemoved; |
|
|
|
} |
|
|
|
|
|
|
|
styler?.ApplyStyles(this); |
|
|
|
|
|
|
|
ClientSize = impl.ClientSize; |
|
|
|
@ -215,10 +224,7 @@ namespace Avalonia.Controls |
|
|
|
/// <inheritdoc/>
|
|
|
|
double IRenderRoot.RenderScaling => PlatformImpl?.Scaling ?? 1; |
|
|
|
|
|
|
|
IStyleHost IStyleHost.StylingParent |
|
|
|
{ |
|
|
|
get { return AvaloniaLocator.Current.GetService<IGlobalStyles>(); } |
|
|
|
} |
|
|
|
IStyleHost IStyleHost.StylingParent => _globalStyles; |
|
|
|
|
|
|
|
IRenderTarget IRenderRoot.CreateRenderTarget() => CreateRenderTarget(); |
|
|
|
|
|
|
|
@ -267,6 +273,12 @@ namespace Avalonia.Controls |
|
|
|
/// </summary>
|
|
|
|
protected virtual void HandleClosed() |
|
|
|
{ |
|
|
|
if (_globalStyles is object) |
|
|
|
{ |
|
|
|
_globalStyles.GlobalStylesAdded -= ((IStyleHost)this).StylesAdded; |
|
|
|
_globalStyles.GlobalStylesRemoved -= ((IStyleHost)this).StylesRemoved; |
|
|
|
} |
|
|
|
|
|
|
|
var logicalArgs = new LogicalTreeAttachmentEventArgs(this, this, null); |
|
|
|
((ILogical)this).NotifyDetachedFromLogicalTree(logicalArgs); |
|
|
|
|
|
|
|
|