prevent adorner getting stuck on screen.
MODIFY
WalletWasabi.Fluent/Behaviors/HistoryItemDetailsBehavior.cs
WalletWasabi.Fluent/Behaviors/HistoryItemDetailsBehavior.cs
using System.Reactive.Disposables;
+using System.Reactive.Linq;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
@@ -17,27 +18,17 @@ namespace WalletWasabi.Fluent.Behaviors
{
if (AssociatedObject is not null)
{
- disposables.Add(
- AssociatedObject
- .GetObservable(InputElement.IsPointerOverProperty)
+ Observable.FromEventPattern(AssociatedObject, nameof(AssociatedObject.DetachedFromVisualTree))
.Subscribe(x =>
{
- if (AssociatedObject.IsPointerOver)
- {
- AddAdorner(AssociatedObject);
- }
- else
- {
- CheckIfShouldRemove();
- }
- }));
+ Remove();
+ });
- disposables.Add(
AssociatedObject
- .GetObservable(ListBoxItem.IsSelectedProperty)
+ .GetObservable(InputElement.IsPointerOverProperty)
.Subscribe(x =>
{
- if (AssociatedObject.IsSelected)
+ if (AssociatedObject.IsPointerOver)
{
AddAdorner(AssociatedObject);
}
@@ -45,7 +36,8 @@ namespace WalletWasabi.Fluent.Behaviors
{
CheckIfShouldRemove();
}
- }));
+ })
+ .DisposeWith(disposables);
}
}
@@ -61,10 +53,8 @@ namespace WalletWasabi.Fluent.Behaviors
});
}
- protected override void OnDetaching()
+ private void Remove()
{
- base.OnDetaching();
-
if (AssociatedObject is not null)
{
RemoveAdorner(AssociatedObject);
@@ -74,6 +64,13 @@ namespace WalletWasabi.Fluent.Behaviors
_currentAdornerEvents = null;
}
+ protected override void OnDetaching()
+ {
+ Remove();
+
+ base.OnDetaching();
+ }
+
private void AddAdorner(DataBoxRow dataBoxRow)
{
_currentAdornerEvents?.Dispose();

prevent adorner getting stuck on screen.