Browse Source

Merge pull request #11158 from AvaloniaUI/onformfactor_fix

Fix OnFormFactor use in DataTemplates
pull/11193/head
Max Katz 3 years ago
committed by GitHub
parent
commit
6e2e17997a
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      src/Markup/Avalonia.Markup.Xaml/XamlIl/Runtime/XamlIlRuntimeHelpers.cs

7
src/Markup/Avalonia.Markup.Xaml/XamlIl/Runtime/XamlIlRuntimeHelpers.cs

@ -50,6 +50,7 @@ namespace Avalonia.Markup.Xaml.XamlIl.Runtime
private readonly IServiceProvider? _parentProvider;
private readonly List<IResourceNode>? _parentResourceNodes;
private readonly INameScope _nameScope;
private IRuntimePlatform? _runtimePlatform;
public DeferredParentServiceProvider(IServiceProvider? parentProvider, List<IResourceNode>? parentResourceNodes,
object rootObject, INameScope nameScope)
@ -80,6 +81,12 @@ namespace Avalonia.Markup.Xaml.XamlIl.Runtime
return this;
if (serviceType == typeof(IAvaloniaXamlIlControlTemplateProvider))
return this;
if (serviceType == typeof(IRuntimePlatform))
{
if(_runtimePlatform == null)
_runtimePlatform = AvaloniaLocator.Current.GetService<IRuntimePlatform>();
return _runtimePlatform;
}
return _parentProvider?.GetService(serviceType);
}

Loading…
Cancel
Save