Improve behavior and UX
MODIFY
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
WalletWasabi.Fluent/ViewModels/MainViewModel.cs
@@ -14,6 +14,7 @@ using WalletWasabi.Fluent.ViewModels.Settings;
using WalletWasabi.Fluent.ViewModels.TransactionBroadcasting;
using WalletWasabi.Fluent.ViewModels.HelpAndSupport;
using WalletWasabi.Fluent.ViewModels.OpenDirectory;
+using WalletWasabi.Fluent.ViewModels.SearchBarTextPart;
using WalletWasabi.Logging;
using WalletWasabi.Fluent.ViewModels.StatusBar;
using WalletWasabi.Fluent.ViewModels.Wallets;
@@ -179,12 +180,16 @@ public partial class MainViewModel : ViewModelBase
}
}
});
+
+ SearchBar = new SearchBarViewModel(SearchItemProvider.GetSearchItems());
}
public TargettedNavigationStack MainScreen { get; }
public MusicControlsViewModel MusicControls { get; }
+ public SearchBarViewModel SearchBar { get; }
+
public static MainViewModel Instance { get; } = new();
public void ClearStacks()

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/AutoSelectFirstItemBehavior.cs
WalletWasabi.Fluent/ViewModels/SearchBar/AutoSelectFirstItemBehavior.cs
@@ -8,7 +8,7 @@ using Avalonia.Controls.Primitives;
using Avalonia.Xaml.Interactivity;
using ReactiveUI;
-namespace WalletWasabi.Fluent.ViewModels.SearchBar;
+namespace WalletWasabi.Fluent.ViewModels.SearchBarTextPart;
public class AutoSelectFirstItemBehavior : Behavior<SelectingItemsControl>
{

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/SearchBarDesignViewModel.cs
WalletWasabi.Fluent/ViewModels/SearchBar/SearchBarDesignViewModel.cs
@@ -4,7 +4,7 @@ using System.Reactive.Linq;
using DynamicData;
using ReactiveUI;
-namespace WalletWasabi.Fluent.ViewModels.SearchBar;
+namespace WalletWasabi.Fluent.ViewModels.SearchBarTextPart;
public class SearchBarDesignViewModel : ReactiveObject
{

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/SearchBarViewModel.cs
WalletWasabi.Fluent/ViewModels/SearchBar/SearchBarViewModel.cs
@@ -4,7 +4,7 @@ using System.Reactive.Linq;
using DynamicData;
using ReactiveUI;
-namespace WalletWasabi.Fluent.ViewModels.SearchBar;
+namespace WalletWasabi.Fluent.ViewModels.SearchBarTextPart;
public class SearchBarViewModel : ReactiveObject
{

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/SearchItem.cs
WalletWasabi.Fluent/ViewModels/SearchBar/SearchItem.cs
@@ -2,7 +2,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Windows.Input;
-namespace WalletWasabi.Fluent.ViewModels.SearchBar;
+namespace WalletWasabi.Fluent.ViewModels.SearchBarTextPart;
public class SearchItem
{

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/SearchItemGroup.cs
WalletWasabi.Fluent/ViewModels/SearchBar/SearchItemGroup.cs
@@ -3,7 +3,7 @@ using System.Reactive.Linq;
using DynamicData;
using ReactiveUI;
-namespace WalletWasabi.Fluent.ViewModels.SearchBar;
+namespace WalletWasabi.Fluent.ViewModels.SearchBarTextPart;
public class SearchItemGroup
{

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/SearchItemProvider.cs
WalletWasabi.Fluent/ViewModels/SearchBar/SearchItemProvider.cs
@@ -4,7 +4,7 @@ using System.Reactive.Linq;
using ReactiveUI;
using WalletWasabi.Fluent.ViewModels.Navigation;
-namespace WalletWasabi.Fluent.ViewModels.SearchBar;
+namespace WalletWasabi.Fluent.ViewModels.SearchBarTextPart;
public static class SearchItemProvider
{

MODIFY
WalletWasabi.Fluent/ViewModels/SearchBar/ValueObject.cs
WalletWasabi.Fluent/ViewModels/SearchBar/ValueObject.cs
using System.Collections.Generic;
using System.Linq;
-namespace WalletWasabi.Fluent.ViewModels.SearchBar
+namespace WalletWasabi.Fluent.ViewModels.SearchBarTextPart
{
[Serializable]
public abstract class ValueObject : IComparable, IComparable<ValueObject>

MODIFY
WalletWasabi.Fluent/Views/MainView.axaml
WalletWasabi.Fluent/Views/MainView.axaml
xmlns:spectrum="clr-namespace:WalletWasabi.Fluent.Controls.Spectrum"
xmlns:converters="clr-namespace:WalletWasabi.Fluent.Converters"
xmlns:searchBar="clr-namespace:WalletWasabi.Fluent.Views.SearchBar"
- mc:Ignorable="d" d:DesignWidth="536" d:DesignHeight="459"
+ mc:Ignorable="d" d:DesignWidth="1200" d:DesignHeight="459"
x:DataType="vm:MainViewModel"
x:CompileBindings="True"
x:Class="WalletWasabi.Fluent.Views.MainView">
</Panel>
</Border>
- <searchBar:SearchBar Grid.RowSpan="2" Grid.Column="{ext:Platform 0, Osx=1}" Grid.ColumnSpan="2" HorizontalAlignment="Center" Width="250" />
+ <searchBar:SearchBar x:Name="SearchBar" VerticalAlignment="Center" DataContext="{Binding SearchBar}" Grid.Column="1"
+ HorizontalAlignment="Center" Width="250" />
+ <searchBar:SearchBarDropdown Width="400" MaxHeight="500" VerticalAlignment="Top" IsVisible="{Binding #SearchBar.IsKeyboardFocusWithin}" Grid.Row="1"
+ Grid.Column="1" DataContext="{Binding SearchBar}" />
</Grid>
</Panel>
<ExperimentalAcrylicBorder DockPanel.Dock="Left" IsHitTestVisible="False"

DELETE
WalletWasabi.Fluent/Views/SearchBar/SearchBar.axaml.cs
-using System.Linq;
-using System.Reactive.Linq;
-using System.Threading.Tasks;
-using Avalonia.Controls;
-using Avalonia.Markup.Xaml;
-using WalletWasabi.Fluent.ViewModels.NavBar;
-using WalletWasabi.Fluent.ViewModels.Navigation;
-using WalletWasabi.Fluent.ViewModels.Search;
-using WalletWasabi.Fluent.ViewModels.SearchBar;
-
-namespace WalletWasabi.Fluent.Views.SearchBar;
-
-public class SearchBar : UserControl
-{
- public SearchBar()
- {
- InitializeComponent();
- }
-
- private void InitializeComponent()
- {
- AvaloniaXamlLoader.Load(this);
-
- DataContext = new SearchBarViewModel(SearchItemProvider.GetSearchItems());
- }
-}
\ No newline at end of file

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"
x:Class="WalletWasabi.Fluent.Views.SearchBar.SearchBarDropdown"
- xmlns:searchBar="clr-namespace:WalletWasabi.Fluent.ViewModels.SearchBar"
- xmlns:ia="clr-namespace:Avalonia.Xaml.Interactions.Core;assembly=Avalonia.Xaml.Interactions"
- x:CompileBindings="True"
+ xmlns:searchBar="clr-namespace:WalletWasabi.Fluent.ViewModels.SearchBarTextPart"
+ x:CompileBindings="False"
x:DataType="searchBar:SearchBarViewModel"
xmlns:conv="clr-namespace:WalletWasabi.Fluent.Converters" Background="{StaticResource SystemBaseLowColor}">

RENAME
WalletWasabi.Fluent/Views/SearchBar/SearchBar.axaml
WalletWasabi.Fluent/Views/SearchBar/SearchBarTextPart.axaml
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
- mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
+ mc:Ignorable="d"
x:Class="WalletWasabi.Fluent.Views.SearchBar.SearchBar"
- xmlns:searchBar="clr-namespace:WalletWasabi.Fluent.ViewModels.SearchBar"
- xmlns:s="clr-namespace:WalletWasabi.Fluent.Views.SearchBar"
+ xmlns:searchBar="clr-namespace:WalletWasabi.Fluent.ViewModels.SearchBarTextPart"
x:Name="UserControl">
<Design.DataContext>
<Setter Property="BorderBrush" Value="White" />
<Setter Property="BorderThickness" Value="1 1 1 1" />
<Setter Property="CornerRadius" Value="4" />
+ <Setter Property="Margin" Value="0" />
+ <Setter Property="FontSize" Value="12"></Setter>
+ <Setter Property="Padding" Value="6 3"></Setter>
+ <Setter Property="VerticalContentAlignment" Value="Center"></Setter>
+ <Setter Property="MinHeight" Value="8"></Setter>
</Style>
<Style Selector="TextBox#SearchBox /template/ Border#PART_BorderElement">
<Setter Property="CornerRadius" Value="5" />
</Style>
+ <Style Selector="TextBox#SearchBox /template/ DataValidationErrors">
+ <Setter Property="IsVisible" Value="False"></Setter>
+ </Style>
+
<Style Selector="TextBox:pointerover">
<Setter Property="Foreground" Value="White" />
<Setter Property="Cursor" Value="Hand" />
</Style>
</UserControl.Styles>
- <StackPanel>
- <TextBox x:Name="SearchBox" DockPanel.Dock="Top" Watermark="Search for settings and advanced features" Text="{Binding SearchText, Mode=TwoWay}" />
- <s:SearchBarDropdown MaxHeight="500" IsVisible="{Binding #UserControl.IsKeyboardFocusWithin}" />
- </StackPanel>
+ <TextBox x:Name="SearchBox" Watermark="Search for settings and advanced features" Text="{Binding SearchText, Mode=TwoWay}" />
+
</UserControl>
\ No newline at end of file

ADD
WalletWasabi.Fluent/Views/SearchBar/SearchBarTextPart.axaml.cs
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace WalletWasabi.Fluent.Views.SearchBar;
+
+public class SearchBar : UserControl
+{
+ public SearchBar()
+ {
+ InitializeComponent();
+ }
+
+ private void InitializeComponent()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+}
\ No newline at end of file

MODIFY
WalletWasabi.Fluent/WalletWasabi.Fluent.csproj
WalletWasabi.Fluent/WalletWasabi.Fluent.csproj
<ItemGroup>
<RuntimeHostConfigurationOption Include="System.Globalization.Invariant" Value="true" />
</ItemGroup>
+
+ <ItemGroup>
+ <Compile Update="Views\SearchBar\SearchBarTextPart.axaml.cs">
+ <DependentUpon>SearchBarTextPart.axaml</DependentUpon>
+ </Compile>
+ </ItemGroup>
</Project>

Improve behavior and UX