|
|
@@ -9,19 +9,22 @@ namespace Avalonia.ReactiveUI
|
|
|
{
|
|
|
/// <summary>
|
|
|
/// Initializes ReactiveUI framework to use with Avalonia. Registers Avalonia
|
|
|
- /// scheduler and Avalonia activation for view fetcher. Always remember to
|
|
|
- /// call this method if you are using ReactiveUI in your application.
|
|
|
+ /// scheduler, an activation for view fetcher, a template binding hook. Remember
|
|
|
+ /// to call this method if you are using ReactiveUI in your application.
|
|
|
/// </summary>
|
|
|
public static TAppBuilder UseReactiveUI<TAppBuilder>(this TAppBuilder builder)
|
|
|
- where TAppBuilder : AppBuilderBase<TAppBuilder>, new()
|
|
|
- {
|
|
|
- return builder.AfterPlatformServicesSetup(_ =>
|
|
|
+ where TAppBuilder : AppBuilderBase<TAppBuilder>, new() =>
|
|
|
+ builder.AfterPlatformServicesSetup(_ => Locator.RegisterResolverCallbackChanged(() =>
|
|
|
{
|
|
|
+ if (Locator.CurrentMutable is null)
|
|
|
+ {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
PlatformRegistrationManager.SetRegistrationNamespaces(RegistrationNamespace.Avalonia);
|
|
|
RxApp.MainThreadScheduler = AvaloniaScheduler.Instance;
|
|
|
Locator.CurrentMutable.RegisterConstant(new AvaloniaActivationForViewFetcher(), typeof(IActivationForViewFetcher));
|
|
|
Locator.CurrentMutable.RegisterConstant(new AutoDataTemplateBindingHook(), typeof(IPropertyBindingHook));
|
|
|
- });
|
|
|
- }
|
|
|
+ }));
|
|
|
}
|
|
|
}
|