diff --git a/build/ReactiveUI.props b/build/ReactiveUI.props
index f827cb9a32..d8e86e917e 100644
--- a/build/ReactiveUI.props
+++ b/build/ReactiveUI.props
@@ -1,5 +1,5 @@
-
+
diff --git a/src/Avalonia.Controls/Window.cs b/src/Avalonia.Controls/Window.cs
index d8e7f3a387..317b6d3f2e 100644
--- a/src/Avalonia.Controls/Window.cs
+++ b/src/Avalonia.Controls/Window.cs
@@ -652,8 +652,8 @@ namespace Avalonia.Controls
PlatformImpl?.Show();
Renderer?.Start();
+ SetWindowStartupLocation(Owner?.PlatformImpl);
}
- SetWindowStartupLocation(Owner?.PlatformImpl);
OnOpened(EventArgs.Empty);
}
diff --git a/src/Avalonia.Controls/WindowBase.cs b/src/Avalonia.Controls/WindowBase.cs
index eb6e7319f5..1efd6c8c1d 100644
--- a/src/Avalonia.Controls/WindowBase.cs
+++ b/src/Avalonia.Controls/WindowBase.cs
@@ -39,6 +39,7 @@ namespace Avalonia.Controls
public static readonly StyledProperty TopmostProperty =
AvaloniaProperty.Register(nameof(Topmost));
+ private int _autoSizing;
private bool _hasExecutedInitialLayoutPass;
private bool _isActive;
private bool _ignoreVisibilityChange;
@@ -97,11 +98,7 @@ namespace Avalonia.Controls
///
/// Whether an auto-size operation is in progress.
///
- protected bool AutoSizing
- {
- get;
- private set;
- }
+ protected bool AutoSizing => _autoSizing > 0;
///
/// Gets or sets the owner of the window.
@@ -186,8 +183,8 @@ namespace Avalonia.Controls
///
protected IDisposable BeginAutoSizing()
{
- AutoSizing = true;
- return Disposable.Create(() => AutoSizing = false);
+ ++_autoSizing;
+ return Disposable.Create(() => --_autoSizing);
}
///
diff --git a/src/Avalonia.ReactiveUI/AutoDataTemplateBindingHook.cs b/src/Avalonia.ReactiveUI/AutoDataTemplateBindingHook.cs
index 4881c77034..fe4e9dd94a 100644
--- a/src/Avalonia.ReactiveUI/AutoDataTemplateBindingHook.cs
+++ b/src/Avalonia.ReactiveUI/AutoDataTemplateBindingHook.cs
@@ -48,6 +48,10 @@ namespace Avalonia.ReactiveUI
if (itemsControl.ItemTemplate != null)
return true;
+ if (itemsControl.DataTemplates != null &&
+ itemsControl.DataTemplates.Count > 0)
+ return true;
+
itemsControl.ItemTemplate = DefaultItemTemplate;
return true;
}
diff --git a/src/Avalonia.ReactiveUI/RoutedViewHost.cs b/src/Avalonia.ReactiveUI/RoutedViewHost.cs
index 1af8012a20..421633cd58 100644
--- a/src/Avalonia.ReactiveUI/RoutedViewHost.cs
+++ b/src/Avalonia.ReactiveUI/RoutedViewHost.cs
@@ -65,8 +65,15 @@ namespace Avalonia.ReactiveUI
{
this.WhenActivated(disposables =>
{
- this.WhenAnyObservable(x => x.Router.CurrentViewModel)
- .DistinctUntilChanged()
+ var routerRemoved = this
+ .WhenAnyValue(x => x.Router)
+ .Where(router => router == null)
+ .Cast