diff --git a/samples/BindingDemo/App.xaml.cs b/samples/BindingDemo/App.xaml.cs
index 01c52a2a49..f2f44cd502 100644
--- a/samples/BindingDemo/App.xaml.cs
+++ b/samples/BindingDemo/App.xaml.cs
@@ -3,6 +3,7 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Logging.Serilog;
using Avalonia.Markup.Xaml;
+using Avalonia.ReactiveUI;
using Serilog;
namespace BindingDemo
diff --git a/samples/ControlCatalog.Desktop/Program.cs b/samples/ControlCatalog.Desktop/Program.cs
index dd5644dd6b..b7aa34f5ba 100644
--- a/samples/ControlCatalog.Desktop/Program.cs
+++ b/samples/ControlCatalog.Desktop/Program.cs
@@ -4,6 +4,7 @@ using Avalonia;
using Avalonia.Controls;
using Avalonia.Logging.Serilog;
using Avalonia.Platform;
+using Avalonia.ReactiveUI;
using Serilog;
namespace ControlCatalog
diff --git a/samples/ControlCatalog.NetCore/Program.cs b/samples/ControlCatalog.NetCore/Program.cs
index d13a5b5ef3..c8f3fb9921 100644
--- a/samples/ControlCatalog.NetCore/Program.cs
+++ b/samples/ControlCatalog.NetCore/Program.cs
@@ -4,6 +4,7 @@ using System.Linq;
using System.Threading;
using Avalonia;
using Avalonia.Skia;
+using Avalonia.ReactiveUI;
namespace ControlCatalog.NetCore
{
diff --git a/samples/RenderDemo/App.xaml.cs b/samples/RenderDemo/App.xaml.cs
index 0f627961e6..d95018520a 100644
--- a/samples/RenderDemo/App.xaml.cs
+++ b/samples/RenderDemo/App.xaml.cs
@@ -4,6 +4,7 @@
using Avalonia;
using Avalonia.Logging.Serilog;
using Avalonia.Markup.Xaml;
+using Avalonia.ReactiveUI;
namespace RenderDemo
{
diff --git a/samples/VirtualizationDemo/Program.cs b/samples/VirtualizationDemo/Program.cs
index 98f1f08d6c..9d8f7c1a3d 100644
--- a/samples/VirtualizationDemo/Program.cs
+++ b/samples/VirtualizationDemo/Program.cs
@@ -5,6 +5,7 @@ using System;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Logging.Serilog;
+using Avalonia.ReactiveUI;
using Serilog;
namespace VirtualizationDemo
diff --git a/src/Avalonia.Base/Utilities/WeakEventHandlerManager.cs b/src/Avalonia.Base/Utilities/WeakEventHandlerManager.cs
index 0ade1af249..b59ed166bc 100644
--- a/src/Avalonia.Base/Utilities/WeakEventHandlerManager.cs
+++ b/src/Avalonia.Base/Utilities/WeakEventHandlerManager.cs
@@ -19,6 +19,7 @@ namespace Avalonia.Utilities
///
/// The type of the target.
/// The type of the event arguments.
+ /// The type of the subscriber.
/// The event source.
/// The name of the event.
/// The subscriber.
@@ -40,6 +41,7 @@ namespace Avalonia.Utilities
/// Unsubscribes from an event.
///
/// The type of the event arguments.
+ /// The type of the subscriber.
/// The event source.
/// The name of the event.
/// The subscriber.
diff --git a/src/Avalonia.Controls/Window.cs b/src/Avalonia.Controls/Window.cs
index f5af6774b5..c8e09b8f9c 100644
--- a/src/Avalonia.Controls/Window.cs
+++ b/src/Avalonia.Controls/Window.cs
@@ -291,7 +291,8 @@ namespace Avalonia.Controls
///
/// The dialog result.
///
- /// When the window is shown with the method, the
+ /// When the window is shown with the
+ /// or method, the
/// resulting task will produce the value when the window
/// is closed.
///
diff --git a/src/Avalonia.ReactiveUI/AppBuilderExtensions.cs b/src/Avalonia.ReactiveUI/AppBuilderExtensions.cs
index d763febdf3..f67cb7f40a 100644
--- a/src/Avalonia.ReactiveUI/AppBuilderExtensions.cs
+++ b/src/Avalonia.ReactiveUI/AppBuilderExtensions.cs
@@ -6,10 +6,15 @@ using Avalonia.Threading;
using ReactiveUI;
using Splat;
-namespace Avalonia
+namespace Avalonia.ReactiveUI
{
public static class AppBuilderExtensions
{
+ ///
+ /// 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.
+ ///
public static TAppBuilder UseReactiveUI(this TAppBuilder builder)
where TAppBuilder : AppBuilderBase, new()
{
diff --git a/src/Avalonia.ReactiveUI/Attributes.cs b/src/Avalonia.ReactiveUI/Attributes.cs
new file mode 100644
index 0000000000..e908d1de80
--- /dev/null
+++ b/src/Avalonia.ReactiveUI/Attributes.cs
@@ -0,0 +1,8 @@
+// Copyright (c) The Avalonia Project. All rights reserved.
+// Licensed under the MIT license. See licence.md file in the project root for full license information.
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using Avalonia.Metadata;
+
+[assembly: XmlnsDefinition("http://reactiveui.net", "Avalonia.ReactiveUI")]
\ No newline at end of file
diff --git a/src/Avalonia.ReactiveUI/AvaloniaActivationForViewFetcher.cs b/src/Avalonia.ReactiveUI/AvaloniaActivationForViewFetcher.cs
index e1db604e95..cfa7a270be 100644
--- a/src/Avalonia.ReactiveUI/AvaloniaActivationForViewFetcher.cs
+++ b/src/Avalonia.ReactiveUI/AvaloniaActivationForViewFetcher.cs
@@ -9,15 +9,24 @@ using Avalonia.VisualTree;
using Avalonia.Controls;
using ReactiveUI;
-namespace Avalonia
+namespace Avalonia.ReactiveUI
{
+ ///
+ /// Determines when Avalonia IVisuals get activated.
+ ///
public class AvaloniaActivationForViewFetcher : IActivationForViewFetcher
{
+ ///
+ /// Returns affinity for view.
+ ///
public int GetAffinityForView(Type view)
{
return typeof(IVisual).GetTypeInfo().IsAssignableFrom(view.GetTypeInfo()) ? 10 : 0;
}
+ ///
+ /// Returns activation observable for activatable Avalonia view.
+ ///
public IObservable GetActivationForView(IActivatable view)
{
if (!(view is IVisual visual)) return Observable.Return(false);
@@ -25,6 +34,9 @@ namespace Avalonia
return GetActivationForVisual(visual);
}
+ ///
+ /// Listens to Opened and Closed events for Avalonia windows.
+ ///
private IObservable GetActivationForWindowBase(WindowBase window)
{
var windowLoaded = Observable
@@ -42,6 +54,10 @@ namespace Avalonia
.DistinctUntilChanged();
}
+ ///
+ /// Listens to AttachedToVisualTree and DetachedFromVisualTree
+ /// events for Avalonia IVisuals.
+ ///
private IObservable GetActivationForVisual(IVisual visual)
{
var visualLoaded = Observable
diff --git a/src/Avalonia.ReactiveUI/ReactiveUserControl.cs b/src/Avalonia.ReactiveUI/ReactiveUserControl.cs
index 43e2ef93b6..010acc3ae0 100644
--- a/src/Avalonia.ReactiveUI/ReactiveUserControl.cs
+++ b/src/Avalonia.ReactiveUI/ReactiveUserControl.cs
@@ -6,7 +6,7 @@ using Avalonia.VisualTree;
using Avalonia.Controls;
using ReactiveUI;
-namespace Avalonia
+namespace Avalonia.ReactiveUI
{
///
/// A ReactiveUI UserControl that implements
diff --git a/src/Avalonia.ReactiveUI/ReactiveWindow.cs b/src/Avalonia.ReactiveUI/ReactiveWindow.cs
index bb50a37764..f0f115afbc 100644
--- a/src/Avalonia.ReactiveUI/ReactiveWindow.cs
+++ b/src/Avalonia.ReactiveUI/ReactiveWindow.cs
@@ -6,7 +6,7 @@ using Avalonia.VisualTree;
using Avalonia.Controls;
using ReactiveUI;
-namespace Avalonia
+namespace Avalonia.ReactiveUI
{
///
/// A ReactiveUI Window that implements
diff --git a/src/Avalonia.ReactiveUI/RoutedViewHost.cs b/src/Avalonia.ReactiveUI/RoutedViewHost.cs
index e364d5de0b..4bd86a67c0 100644
--- a/src/Avalonia.ReactiveUI/RoutedViewHost.cs
+++ b/src/Avalonia.ReactiveUI/RoutedViewHost.cs
@@ -1,13 +1,17 @@
+// Copyright (c) The Avalonia Project. All rights reserved.
+// Licensed under the MIT license. See licence.md file in the project root for full license information.
+
using System;
using System.Reactive.Disposables;
using System.Reactive.Linq;
using Avalonia.Animation;
using Avalonia.Controls;
using Avalonia.Styling;
+using Avalonia;
using ReactiveUI;
using Splat;
-namespace Avalonia
+namespace Avalonia.ReactiveUI
{
///
/// This control hosts the View associated with ReactiveUI RoutingState,
@@ -157,7 +161,7 @@ namespace Avalonia
return;
}
- var viewLocator = ViewLocator ?? ReactiveUI.ViewLocator.Current;
+ var viewLocator = ViewLocator ?? global::ReactiveUI.ViewLocator.Current;
var view = viewLocator.ResolveView(viewModel);
if (view == null) throw new Exception($"Couldn't find view for '{viewModel}'. Is it registered?");
diff --git a/src/Avalonia.Styling/StyledElement.cs b/src/Avalonia.Styling/StyledElement.cs
index e52a1961ba..d314a8d44e 100644
--- a/src/Avalonia.Styling/StyledElement.cs
+++ b/src/Avalonia.Styling/StyledElement.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
+using System.ComponentModel;
using System.Linq;
using System.Reactive.Linq;
using System.Reactive.Subjects;
diff --git a/tests/Avalonia.ReactiveUI.UnitTests/AvaloniaActivationForViewFetcherTest.cs b/tests/Avalonia.ReactiveUI.UnitTests/AvaloniaActivationForViewFetcherTest.cs
index 70a5504a7d..d9f1ce47dd 100644
--- a/tests/Avalonia.ReactiveUI.UnitTests/AvaloniaActivationForViewFetcherTest.cs
+++ b/tests/Avalonia.ReactiveUI.UnitTests/AvaloniaActivationForViewFetcherTest.cs
@@ -11,6 +11,7 @@ using DynamicData;
using Xunit;
using Splat;
using Avalonia.Markup.Xaml;
+using Avalonia.ReactiveUI;
namespace Avalonia
{
diff --git a/tests/Avalonia.ReactiveUI.UnitTests/RoutedViewHostTest.cs b/tests/Avalonia.ReactiveUI.UnitTests/RoutedViewHostTest.cs
index de09a1ea89..401d169896 100644
--- a/tests/Avalonia.ReactiveUI.UnitTests/RoutedViewHostTest.cs
+++ b/tests/Avalonia.ReactiveUI.UnitTests/RoutedViewHostTest.cs
@@ -14,6 +14,7 @@ using Avalonia.Markup.Xaml;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Reactive;
+using Avalonia.ReactiveUI;
namespace Avalonia
{