use ResolveByName property and remove properties not required.
MODIFY
WalletWasabi.Fluent/AddWallet/Common/EnterPasswordView.axaml
WalletWasabi.Fluent/AddWallet/Common/EnterPasswordView.axaml
<DockPanel>
<PathIcon Classes="checkMark" Margin="15 42 0 0" VerticalAlignment="Top" DockPanel.Dock="Right">
<i:Interaction.Behaviors>
- <behaviors:CheckMarkVisibilityBehavior OwnerTextBox="{Binding #TbPassword}" Text="{Binding #TbPassword.Text}" />
+ <behaviors:CheckMarkVisibilityBehavior OwnerTextBox="TbPassword" />
</i:Interaction.Behaviors>
</PathIcon>
<Label Content="_Type a password:" Target="TbPassword" DockPanel.Dock="Top"/>
<DockPanel>
<PathIcon Classes="checkMark" Margin="15 42 0 0" VerticalAlignment="Top" DockPanel.Dock="Right">
<i:Interaction.Behaviors>
- <behaviors:CheckMarkVisibilityBehavior OwnerTextBox="{Binding #TbConfirmPassword}" Text="{Binding #TbConfirmPassword.Text}" />
+ <behaviors:CheckMarkVisibilityBehavior OwnerTextBox="TbConfirmPassword" />
</i:Interaction.Behaviors>
</PathIcon>
<Label Content="_Type a password:" Target="TbConfirmPassword" DockPanel.Dock="Top"/>

MODIFY
WalletWasabi.Fluent/Behaviors/CheckMarkVisibilityBehavior.cs
WalletWasabi.Fluent/Behaviors/CheckMarkVisibilityBehavior.cs
@@ -2,49 +2,27 @@ using Avalonia;
using Avalonia.Controls;
using ReactiveUI;
using System;
+using System.Reactive;
+using System.Reactive.Disposables;
using System.Reactive.Linq;
+using Avalonia.Input;
namespace WalletWasabi.Fluent.Behaviors
{
- public class CheckMarkVisibilityBehavior : AttachedToVisualTreeBehavior<PathIcon>
+ public class CheckMarkVisibilityBehavior : DisposingBehavior<PathIcon>
{
- public static readonly StyledProperty<bool> HasErrorsProperty =
- AvaloniaProperty.Register<CheckMarkVisibilityBehavior, bool>(nameof(HasErrors), false);
-
- public static readonly StyledProperty<bool> IsFocusedProperty =
- AvaloniaProperty.Register<CheckMarkVisibilityBehavior, bool>(nameof(IsFocused), false);
-
- public static readonly StyledProperty<string> TextProperty =
- AvaloniaProperty.Register<CheckMarkVisibilityBehavior, string>(nameof(Text), "");
-
- public bool HasErrors
- {
- get => GetValue(HasErrorsProperty);
- set => SetValue(HasErrorsProperty, value);
- }
-
- public bool IsFocused
- {
- get => GetValue(IsFocusedProperty);
- set => SetValue(IsFocusedProperty, value);
- }
-
- public string Text
- {
- get => GetValue(TextProperty);
- set => SetValue(TextProperty, value);
- }
-
public static readonly StyledProperty<TextBox> OwnerTextBoxProperty =
AvaloniaProperty.Register<CheckMarkVisibilityBehavior, TextBox>(nameof(OwnerTextBox), null!);
+ [ResolveByName]
public TextBox OwnerTextBox
{
get => GetValue(OwnerTextBoxProperty);
set => SetValue(OwnerTextBoxProperty, value);
}
- protected override void OnAttachedToVisualTree()
+
+ protected override void OnAttached(CompositeDisposable disposables)
{
this.WhenAnyValue(
x => x.HasErrors,

use ResolveByName property and remove properties not required.