Use Behaviors from official package Avalonia.XamlBehaviors
MODIFY
WalletWasabi.Fluent.Desktop/packages.lock.json
WalletWasabi.Fluent.Desktop/packages.lock.json
},
"Avalonia.Xaml.Behaviors": {
"type": "Transitive",
- "resolved": "0.10.12.2",
- "contentHash": "EqfzwstvqQcWnTJnaBvezxKwBSddozXpkFi5WrzVe976zedE+A1NruFgnC19aG7Vvy0mTQdlWFTtbAInv6IQyg==",
+ "resolved": "0.10.13.1",
+ "contentHash": "Z+wcwoJCKBBds6aHQ7Fddph3027h9tXswlrOxVh7dJEqTUK0MNYHUlyjOaqIOGl2ng3uBK6cs2L2wXG5Cwzf5g==",
"dependencies": {
- "Avalonia": "0.10.12",
- "Avalonia.Xaml.Interactions": "0.10.12.2",
- "Avalonia.Xaml.Interactivity": "0.10.12.2"
+ "Avalonia": "0.10.13",
+ "Avalonia.Xaml.Interactions": "0.10.13.1",
+ "Avalonia.Xaml.Interactivity": "0.10.13.1"
}
},
"Avalonia.Xaml.Interactions": {
"type": "Transitive",
- "resolved": "0.10.12.2",
- "contentHash": "01NGXHMbvpg1JcZ4tFAZXD6i55vHIQnJl3+HFi7RSP1jevkjkSaVM8qjwLsTSfREsJ2OoiWxx2LcyUQJvO5Kjw==",
+ "resolved": "0.10.13.1",
+ "contentHash": "FfBzAwH9TXVk3P+diK8V0t/dYufXCm1tpY7Ok14bll3xMlI+vICObxE7yzXriFTfQO7oaFONaPgdspQnfGKwEg==",
"dependencies": {
- "Avalonia": "0.10.12",
- "Avalonia.Xaml.Interactivity": "0.10.12.2"
+ "Avalonia": "0.10.13",
+ "Avalonia.Xaml.Interactivity": "0.10.13.1"
}
},
"Avalonia.Xaml.Interactivity": {
"type": "Transitive",
- "resolved": "0.10.12.2",
- "contentHash": "AGAbT1I6XW1+9tweLHDMGX8+SijE111vNNIQy2gI3bpbLfPYTirLPyK0do2s9V6l7hHfQnNmiX2NA6JHC4WG4Q==",
+ "resolved": "0.10.13.1",
+ "contentHash": "jCgTyl3sVMIBZwMEHp7PbY3SMGUQfYWVYTPj010HxvkXo9Zrisxm6iPzDlmd57NfEPgMiW0s/zt6yun4IVnVQQ==",
"dependencies": {
- "Avalonia": "0.10.12"
+ "Avalonia": "0.10.13"
}
},
"DynamicData": {
"Avalonia.Diagnostics": "0.10.999-cibuild0019263-beta",
"Avalonia.ReactiveUI": "0.10.999-cibuild0019263-beta",
"Avalonia.Skia": "0.10.999-cibuild0019263-beta",
- "Avalonia.Xaml.Behaviors": "0.10.12.2",
+ "Avalonia.Xaml.Behaviors": "0.10.13.1",
"System.Drawing.Common": "6.0.0",
"System.Reactive": "5.0.0",
"System.Runtime": "4.3.1",

DELETE
WalletWasabi.Fluent/Behaviors/PointerPressTriggerBehavior.cs
-using Avalonia;
-using Avalonia.Controls;
-using Avalonia.Input;
-using Avalonia.Interactivity;
-using Avalonia.Xaml.Interactivity;
-
-namespace WalletWasabi.Fluent.Behaviors;
-
-public class PointerPressTriggerBehavior : Trigger<Control>
-{
- private KeyModifiers _savedKeyModifiers = KeyModifiers.None;
-
- /// <summary>
- /// Identifies the <seealso cref="KeyModifiers"/> avalonia property.
- /// </summary>
- public static readonly StyledProperty<KeyModifiers> KeyModifiersProperty =
- AvaloniaProperty.Register<PointerPressTriggerBehavior, KeyModifiers>(nameof(KeyModifiers));
-
- /// <summary>
- /// Gets or sets the required key modifiers to execute <see cref="Button.ClickEvent"/> event handler. This is a avalonia property.
- /// </summary>
- public KeyModifiers KeyModifiers
- {
- get => GetValue(KeyModifiersProperty);
- set => SetValue(KeyModifiersProperty, value);
- }
-
- /// <summary>
- /// Called after the behavior is attached to the <see cref="Behavior.AssociatedObject"/>.
- /// </summary>
- protected override void OnAttached()
- {
- base.OnAttached();
-
- if (AssociatedObject is { })
- {
- AssociatedObject.AddHandler(InputElement.PointerPressedEvent, PointerPressedHandler, RoutingStrategies.Tunnel);
- }
- }
-
- /// <summary>
- /// Called when the behavior is being detached from its <see cref="Behavior.AssociatedObject"/>.
- /// </summary>
- protected override void OnDetaching()
- {
- base.OnDetaching();
-
- if (AssociatedObject is { })
- {
- AssociatedObject.RemoveHandler(InputElement.PointerPressedEvent, PointerPressedHandler);
- }
- }
-
- private void AssociatedObject_OnClick(object? sender, RoutedEventArgs e)
- {
- if (AssociatedObject is { } && KeyModifiers == _savedKeyModifiers)
- {
- Interaction.ExecuteActions(AssociatedObject, Actions, e);
- }
- }
-
- private void PointerPressedHandler(object? sender, PointerPressedEventArgs e)
- {
- Interaction.ExecuteActions(AssociatedObject, Actions, e);
- }
-}
\ No newline at end of file

DELETE
WalletWasabi.Fluent/Behaviors/RoutedEventTriggerBehavior.cs
-using Avalonia;
-using Avalonia.Interactivity;
-using Avalonia.Xaml.Interactivity;
-
-namespace WalletWasabi.Fluent.Behaviors
-{
- /// <summary>
- /// A behavior that listens for a <see cref="RoutedEvent"/> event on its source and executes its actions when that event is fired.
- /// </summary>
- public class RoutedEventTriggerBehavior : Trigger<Interactive>
- {
- /// <summary>
- /// Identifies the <seealso cref="RoutedEvent"/> avalonia property.
- /// </summary>
- public static readonly StyledProperty<RoutedEvent?> RoutedEventProperty =
- AvaloniaProperty.Register<RoutedEventTriggerBehavior, RoutedEvent?>(nameof(RoutedEvent));
-
- /// <summary>
- /// Identifies the <seealso cref="RoutingStrategies"/> avalonia property.
- /// </summary>
- public static readonly StyledProperty<RoutingStrategies> RoutingStrategiesProperty =
- AvaloniaProperty.Register<RoutedEventTriggerBehavior, RoutingStrategies>(nameof(RoutingStrategies), RoutingStrategies.Direct | RoutingStrategies.Bubble);
-
- /// <summary>
- /// Identifies the <seealso cref="SourceInteractive"/> avalonia property.
- /// </summary>
- public static readonly StyledProperty<Interactive?> SourceInteractiveProperty =
- AvaloniaProperty.Register<RoutedEventTriggerBehavior, Interactive?>(nameof(SourceInteractive));
-
- private bool _isInitialized;
- private bool _isAttached;
-
- /// <summary>
- /// Gets or sets routing event to listen for. This is a avalonia property.
- /// </summary>
- public RoutedEvent? RoutedEvent
- {
- get => GetValue(RoutedEventProperty);
- set => SetValue(RoutedEventProperty, value);
- }
-
- /// <summary>
- /// Gets or sets the routing event <see cref="RoutingStrategies"/>. This is a avalonia property.
- /// </summary>
- public RoutingStrategies RoutingStrategies
- {
- get => GetValue(RoutingStrategiesProperty);
- set => SetValue(RoutingStrategiesProperty, value);
- }
-
- /// <summary>
- /// Gets or sets the source object from which this behavior listens for events.
- /// If <seealso cref="SourceInteractive"/> is not set, the source will default to <seealso cref="Behavior.AssociatedObject"/>. This is a avalonia property.
- /// </summary>
- public Interactive? SourceInteractive
- {
- get => GetValue(SourceInteractiveProperty);
- set => SetValue(SourceInteractiveProperty, value);
- }
-
- static RoutedEventTriggerBehavior()
- {
- RoutedEventProperty.Changed.Subscribe(OnValueChanged);
- RoutingStrategiesProperty.Changed.Subscribe(OnValueChanged);
- SourceInteractiveProperty.Changed.Subscribe(OnValueChanged);
- }
-
- private static void OnValueChanged(AvaloniaPropertyChangedEventArgs args)
- {
- if (args.Sender is not RoutedEventTriggerBehavior behavior || behavior.AssociatedObject is null)
- {
- return;
- }
-
- if (behavior._isInitialized && behavior._isAttached)
- {
- behavior.RemoveHandler();
- behavior.AddHandler();
- }
- }
-
- /// <inheritdoc />
- protected override void OnAttachedToVisualTree()
- {
- _isAttached = true;
- AddHandler();
- }
-
- /// <inheritdoc />
- protected override void OnDetachedFromVisualTree()
- {
- _isAttached = false;
- RemoveHandler();
- }
-
- private void AddHandler()
- {
- var interactive = ComputeResolvedSourceInteractive();
- if (interactive is { } && RoutedEvent is { })
- {
- interactive.AddHandler(RoutedEvent, Handler, RoutingStrategies);
- _isInitialized = true;
- }
- }
-
- private void RemoveHandler()
- {
- var interactive = ComputeResolvedSourceInteractive();
- if (interactive is { } && RoutedEvent is { } && _isInitialized)
- {
- interactive.RemoveHandler(RoutedEvent, Handler);
- _isInitialized = false;
- }
- }
-
- private Interactive? ComputeResolvedSourceInteractive()
- {
- return GetValue(SourceInteractiveProperty) is { } ? SourceInteractive : AssociatedObject;
- }
-
- private void Handler(object? sender, RoutedEventArgs e)
- {
- var interactive = ComputeResolvedSourceInteractive();
- if (interactive is { })
- {
- Interaction.ExecuteActions(interactive, Actions, e);
- }
- }
- }
-}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/Views/MainView.axaml
WalletWasabi.Fluent/Views/MainView.axaml
xmlns:navbar="using:WalletWasabi.Fluent.Views.NavBar"
xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
xmlns:ia="clr-namespace:Avalonia.Xaml.Interactions.Core;assembly=Avalonia.Xaml.Interactions"
- xmlns:b="using:WalletWasabi.Fluent.Behaviors"
+ xmlns:ic="clr-namespace:Avalonia.Xaml.Interactions.Custom;assembly=Avalonia.Xaml.Interactions"
xmlns:ext="using:WalletWasabi.Fluent.Helpers"
xmlns:vm="using:WalletWasabi.Fluent.ViewModels"
xmlns:statusBar="clr-namespace:WalletWasabi.Fluent.Views.StatusBar"
xmlns:wallets="clr-namespace:WalletWasabi.Fluent.Views.Wallets"
xmlns:spectrum="clr-namespace:WalletWasabi.Fluent.Controls.Spectrum"
- xmlns:converters="clr-namespace:WalletWasabi.Fluent.Converters"
xmlns:searchBar="clr-namespace:WalletWasabi.Fluent.Views.SearchBar"
- xmlns:system="clr-namespace:System;assembly=System.Runtime"
mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="459"
x:DataType="vm:MainViewModel"
x:CompileBindings="True"
<Border x:Name="SearchDropDownDismissArea" Background="Transparent" Grid.RowSpan="2" Grid.ColumnSpan="3" IsVisible="False">
<i:Interaction.Behaviors>
- <b:RoutedEventTriggerBehavior RoutedEvent="{x:Static InputElement.PointerPressedEvent}">
- <ia:ChangePropertyAction TargetObject="{Binding #SearchBarDropdown}" PropertyName="IsVisible" Value="False" />
- <ia:ChangePropertyAction TargetObject="{Binding #SearchDropDownDismissArea}" PropertyName="IsVisible" Value="False" />
- </b:RoutedEventTriggerBehavior>
+ <ic:RoutedEventTriggerBehavior RoutedEvent="{x:Static InputElement.PointerPressedEvent}">
+ <ia:ChangePropertyAction TargetObject="SearchBarDropdown" PropertyName="IsVisible" Value="False" />
+ <ia:ChangePropertyAction TargetObject="SearchDropDownDismissArea" PropertyName="IsVisible" Value="False" />
+ </ic:RoutedEventTriggerBehavior>
</i:Interaction.Behaviors>
</Border>
<searchBar:SearchBar x:Name="SearchBar" VerticalAlignment="Center" DataContext="{Binding SearchBar}" Grid.Column="1"
HorizontalAlignment="Center" Width="280">
<i:Interaction.Behaviors>
- <b:RoutedEventTriggerBehavior RoutedEvent="{x:Static InputElement.PointerPressedEvent}" RoutingStrategies="Tunnel">
- <ia:ChangePropertyAction TargetObject="{Binding #SearchBarDropdown}" PropertyName="IsVisible" Value="True" />
- <ia:ChangePropertyAction TargetObject="{Binding #SearchDropDownDismissArea}" PropertyName="IsVisible" Value="True" />
- </b:RoutedEventTriggerBehavior>
+ <ic:RoutedEventTriggerBehavior RoutedEvent="{x:Static InputElement.PointerPressedEvent}" RoutingStrategies="Tunnel">
+ <ia:ChangePropertyAction TargetObject="SearchBarDropdown" PropertyName="IsVisible" Value="True" />
+ <ia:ChangePropertyAction TargetObject="SearchDropDownDismissArea" PropertyName="IsVisible" Value="True" />
+ </ic:RoutedEventTriggerBehavior>
</i:Interaction.Behaviors>
</searchBar:SearchBar>
<searchBar:SearchBarDropdown x:Name="SearchBarDropdown" Width="500" MaxHeight="500" VerticalAlignment="Top" IsVisible="False" Grid.Row="1"

MODIFY
WalletWasabi.Fluent/Views/SearchBar/SearchBarDropdown.axaml
WalletWasabi.Fluent/Views/SearchBar/SearchBarDropdown.axaml
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
xmlns:i="clr-namespace:Avalonia.Xaml.Interactivity;assembly=Avalonia.Xaml.Interactivity"
xmlns:ia="clr-namespace:Avalonia.Xaml.Interactions.Core;assembly=Avalonia.Xaml.Interactions"
+ xmlns:ic="clr-namespace:Avalonia.Xaml.Interactions.Custom;assembly=Avalonia.Xaml.Interactions"
x:Class="WalletWasabi.Fluent.Views.SearchBar.SearchBarDropdown"
xmlns:searchBar="clr-namespace:WalletWasabi.Fluent.ViewModels.SearchBarTextPart"
x:CompileBindings="False"
</DockPanel>
<i:Interaction.Behaviors>
- <b:RoutedEventTriggerBehavior RoutedEvent="{x:Static InputElement.PointerPressedEvent}">
+ <ic:RoutedEventTriggerBehavior RoutedEvent="{x:Static InputElement.PointerPressedEvent}">
<ia:InvokeCommandAction Command="{Binding Command}" />
- </b:RoutedEventTriggerBehavior>
- <b:RoutedEventTriggerBehavior RoutedEvent="{x:Static InputElement.PointerReleasedEvent}">
- <ChangePropertyAction TargetObject="{Binding #UserControl}" PropertyName="IsVisible"
+ </ic:RoutedEventTriggerBehavior>
+ <ic:RoutedEventTriggerBehavior RoutedEvent="{x:Static InputElement.PointerReleasedEvent}">
+ <ChangePropertyAction TargetObject="UserControl" PropertyName="IsVisible"
Value="False" />
- <ChangePropertyAction TargetObject="{Binding #ListBox}" PropertyName="SelectedItem"
+ <ChangePropertyAction TargetObject="ListBox" PropertyName="SelectedItem"
Value="{x:Null}" />
- </b:RoutedEventTriggerBehavior>
+ </ic:RoutedEventTriggerBehavior>
</i:Interaction.Behaviors>
</Panel>

MODIFY
WalletWasabi.Fluent/WalletWasabi.Fluent.csproj
WalletWasabi.Fluent/WalletWasabi.Fluent.csproj
<PackageReference Include="Avalonia.Controls.TreeDataGrid" Version="0.10.10-cibuild0018875-beta" />
<PackageReference Include="Avalonia.ReactiveUI" Version="$(AvaloniaVersion)" />
<PackageReference Include="Avalonia.Diagnostics" Version="$(AvaloniaVersion)" />
- <PackageReference Include="Avalonia.Xaml.Behaviors" Version="0.10.12.2" />
+ <PackageReference Include="Avalonia.Xaml.Behaviors" Version="0.10.13.1" />
<PackageReference Include="Avalonia.Skia" Version="$(AvaloniaVersion)" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.Reactive" Version="5.0.0" />

MODIFY
WalletWasabi.Fluent/packages.lock.json
WalletWasabi.Fluent/packages.lock.json
},
"Avalonia.Xaml.Behaviors": {
"type": "Direct",
- "requested": "[0.10.12.2, )",
- "resolved": "0.10.12.2",
- "contentHash": "EqfzwstvqQcWnTJnaBvezxKwBSddozXpkFi5WrzVe976zedE+A1NruFgnC19aG7Vvy0mTQdlWFTtbAInv6IQyg==",
+ "requested": "[0.10.13.1, )",
+ "resolved": "0.10.13.1",
+ "contentHash": "Z+wcwoJCKBBds6aHQ7Fddph3027h9tXswlrOxVh7dJEqTUK0MNYHUlyjOaqIOGl2ng3uBK6cs2L2wXG5Cwzf5g==",
"dependencies": {
- "Avalonia": "0.10.12",
- "Avalonia.Xaml.Interactions": "0.10.12.2",
- "Avalonia.Xaml.Interactivity": "0.10.12.2"
+ "Avalonia": "0.10.13",
+ "Avalonia.Xaml.Interactions": "0.10.13.1",
+ "Avalonia.Xaml.Interactivity": "0.10.13.1"
}
},
"System.Drawing.Common": {
},
"Avalonia.Xaml.Interactions": {
"type": "Transitive",
- "resolved": "0.10.12.2",
- "contentHash": "01NGXHMbvpg1JcZ4tFAZXD6i55vHIQnJl3+HFi7RSP1jevkjkSaVM8qjwLsTSfREsJ2OoiWxx2LcyUQJvO5Kjw==",
+ "resolved": "0.10.13.1",
+ "contentHash": "FfBzAwH9TXVk3P+diK8V0t/dYufXCm1tpY7Ok14bll3xMlI+vICObxE7yzXriFTfQO7oaFONaPgdspQnfGKwEg==",
"dependencies": {
- "Avalonia": "0.10.12",
- "Avalonia.Xaml.Interactivity": "0.10.12.2"
+ "Avalonia": "0.10.13",
+ "Avalonia.Xaml.Interactivity": "0.10.13.1"
}
},
"Avalonia.Xaml.Interactivity": {
"type": "Transitive",
- "resolved": "0.10.12.2",
- "contentHash": "AGAbT1I6XW1+9tweLHDMGX8+SijE111vNNIQy2gI3bpbLfPYTirLPyK0do2s9V6l7hHfQnNmiX2NA6JHC4WG4Q==",
+ "resolved": "0.10.13.1",
+ "contentHash": "jCgTyl3sVMIBZwMEHp7PbY3SMGUQfYWVYTPj010HxvkXo9Zrisxm6iPzDlmd57NfEPgMiW0s/zt6yun4IVnVQQ==",
"dependencies": {
- "Avalonia": "0.10.12"
+ "Avalonia": "0.10.13"
}
},
"DynamicData": {

Use Behaviors from official package Avalonia.XamlBehaviors